From 08327854b748b8f45c09325199d3347e9f65f866 Mon Sep 17 00:00:00 2001 From: matst80 Date: Tue, 2 Dec 2025 20:40:07 +0100 Subject: [PATCH] split cart and checkout and checkout vs payments --- .gitea/workflows/build.yaml | 5 +- Makefile | 26 +- cmd/cart/k8s-host-discovery.go | 7 +- cmd/cart/main.go | 57 +- cmd/cart/pool-server.go | 385 +-- cmd/cart/product-fetcher.go | 3 +- cmd/{cart => checkout}/amqp-order-handler.go | 0 cmd/{cart => checkout}/checkout_builder.go | 35 +- cmd/{cart => checkout}/checkout_server.go | 66 +- cmd/checkout/k8s-host-discovery.go | 65 + cmd/{cart => checkout}/klarna-client.go | 0 cmd/{cart => checkout}/klarna-types.go | 0 cmd/checkout/main.go | 252 ++ cmd/checkout/otel.go | 117 + cmd/checkout/pool-server.go | 320 ++ deployment/deployment.yaml | 133 + pkg/actor/grpc_server.go | 6 +- pkg/actor/grpc_server_test.go | 15 +- pkg/actor/mutation_registry_test.go | 4 +- pkg/cart/cart-grain.go | 223 +- pkg/cart/cart-mutation-helper.go | 47 +- pkg/cart/cart_grain_totals_test.go | 48 - pkg/cart/mutation_add_giftcard.go | 44 - pkg/cart/mutation_add_item.go | 7 +- pkg/cart/mutation_add_voucher.go | 8 +- pkg/cart/mutation_change_quantity.go | 6 +- pkg/cart/mutation_clear_cart.go | 26 + pkg/cart/mutation_confirmation_viewed.go | 21 - pkg/cart/mutation_create_checkout_order.go | 21 - pkg/cart/mutation_initialize_checkout.go | 59 - pkg/cart/mutation_inventory_reserved.go | 22 - pkg/cart/mutation_line_item_marking.go | 2 +- pkg/cart/mutation_payment_completed.go | 33 - pkg/cart/mutation_payment_declined.go | 27 - pkg/cart/mutation_payment_event.go | 22 - pkg/cart/mutation_precondition.go | 7 - pkg/cart/mutation_remove_giftcard.go | 21 - pkg/cart/mutation_remove_item.go | 6 +- pkg/cart/mutation_remove_line_item_marking.go | 2 +- pkg/cart/mutation_set_delivery.go | 99 - pkg/cart/mutation_set_user_id.go | 2 +- pkg/cart/mutation_subscription_added.go | 6 +- pkg/cart/mutation_test.go | 809 ----- .../mutation_upsert_subscriptiondetails.go | 6 +- pkg/checkout/checkout-grain.go | 184 + pkg/checkout/mutation-context.go | 35 + pkg/checkout/mutation_confirmation_viewed.go | 26 + pkg/checkout/mutation_delivery.go | 55 + pkg/checkout/mutation_initialize_checkout.go | 44 + pkg/checkout/mutation_inventory_reserved.go | 16 + .../mutation_order_created.go | 29 +- pkg/checkout/mutation_payment_completed.go | 37 + pkg/checkout/mutation_payment_declined.go | 28 + pkg/checkout/mutation_payment_event.go | 20 + .../mutation_payment_started.go | 44 +- pkg/checkout/mutation_payments.go | 3 + .../mutation_remove_delivery.go | 20 +- .../mutation_set_pickup_point.go | 34 +- pkg/discovery/discovery.go | 22 +- pkg/discovery/discovery_test.go | 9 +- pkg/messages/messages.pb.go | 3000 ----------------- pkg/proxy/remotehost.go | 2 +- pkg/voucher/service.go | 2 +- proto/cart.proto | 96 + proto/cart/cart.pb.go | 1266 +++++++ proto/checkout.proto | 106 + proto/checkout/checkout.pb.go | 1349 ++++++++ .../control}/control_plane.pb.go | 234 +- .../control}/control_plane_grpc.pb.go | 20 +- proto/control_plane.proto | 4 +- proto/messages.proto | 232 -- 71 files changed, 4555 insertions(+), 5432 deletions(-) rename cmd/{cart => checkout}/amqp-order-handler.go (100%) rename cmd/{cart => checkout}/checkout_builder.go (82%) rename cmd/{cart => checkout}/checkout_server.go (80%) create mode 100644 cmd/checkout/k8s-host-discovery.go rename cmd/{cart => checkout}/klarna-client.go (100%) rename cmd/{cart => checkout}/klarna-types.go (100%) create mode 100644 cmd/checkout/main.go create mode 100644 cmd/checkout/otel.go create mode 100644 cmd/checkout/pool-server.go delete mode 100644 pkg/cart/cart_grain_totals_test.go delete mode 100644 pkg/cart/mutation_add_giftcard.go create mode 100644 pkg/cart/mutation_clear_cart.go delete mode 100644 pkg/cart/mutation_confirmation_viewed.go delete mode 100644 pkg/cart/mutation_create_checkout_order.go delete mode 100644 pkg/cart/mutation_initialize_checkout.go delete mode 100644 pkg/cart/mutation_inventory_reserved.go delete mode 100644 pkg/cart/mutation_payment_completed.go delete mode 100644 pkg/cart/mutation_payment_declined.go delete mode 100644 pkg/cart/mutation_payment_event.go delete mode 100644 pkg/cart/mutation_precondition.go delete mode 100644 pkg/cart/mutation_remove_giftcard.go delete mode 100644 pkg/cart/mutation_set_delivery.go delete mode 100644 pkg/cart/mutation_test.go create mode 100644 pkg/checkout/checkout-grain.go create mode 100644 pkg/checkout/mutation-context.go create mode 100644 pkg/checkout/mutation_confirmation_viewed.go create mode 100644 pkg/checkout/mutation_delivery.go create mode 100644 pkg/checkout/mutation_initialize_checkout.go create mode 100644 pkg/checkout/mutation_inventory_reserved.go rename pkg/{cart => checkout}/mutation_order_created.go (55%) create mode 100644 pkg/checkout/mutation_payment_completed.go create mode 100644 pkg/checkout/mutation_payment_declined.go create mode 100644 pkg/checkout/mutation_payment_event.go rename pkg/{cart => checkout}/mutation_payment_started.go (57%) create mode 100644 pkg/checkout/mutation_payments.go rename pkg/{cart => checkout}/mutation_remove_delivery.go (52%) rename pkg/{cart => checkout}/mutation_set_pickup_point.go (66%) delete mode 100644 pkg/messages/messages.pb.go create mode 100644 proto/cart.proto create mode 100644 proto/cart/cart.pb.go create mode 100644 proto/checkout.proto create mode 100644 proto/checkout/checkout.pb.go rename {pkg/messages => proto/control}/control_plane.pb.go (62%) rename {pkg/messages => proto/control}/control_plane_grpc.pb.go (94%) delete mode 100644 proto/messages.proto diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 29082f8..aba3342 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,6 +1,9 @@ name: Build and Publish run-name: ${{ gitea.actor }} build 🚀 -on: [push] +on: + push: + branches: + - main jobs: BuildAndDeployAmd64: diff --git a/Makefile b/Makefile index 6dbfdc8..4e1e7f6 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,10 @@ MODULE_PATH := git.k6n.net/go-cart-actor PROTO_DIR := proto -PROTOS := $(PROTO_DIR)/messages.proto $(PROTO_DIR)/control_plane.proto +PROTOS := $(PROTO_DIR)/cart.proto $(PROTO_DIR)/control_plane.proto $(PROTO_DIR)/checkout.proto +CART_PROTO_DIR := $(PROTO_DIR)/cart +CONTROL_PROTO_DIR := $(PROTO_DIR)/control +CHECKOUT_PROTO_DIR := $(PROTO_DIR)/checkout # Allow override: make PROTOC=/path/to/protoc PROTOC ?= protoc @@ -69,21 +72,30 @@ check_tools: protogen: check_tools @echo "$(YELLOW)Generating protobuf code (outputs -> ./proto)...$(RESET)" $(PROTOC) -I $(PROTO_DIR) \ - --go_out=./pkg/messages --go_opt=paths=source_relative \ - --go-grpc_out=./pkg/messages --go-grpc_opt=paths=source_relative \ - $(PROTOS) + --go_out=./proto/cart --go_opt=paths=source_relative \ + --go-grpc_out=./proto/cart --go-grpc_opt=paths=source_relative \ + $(PROTO_DIR)/cart.proto + $(PROTOC) -I $(PROTO_DIR) \ + --go_out=./proto/control --go_opt=paths=source_relative \ + --go-grpc_out=./proto/control --go-grpc_opt=paths=source_relative \ + $(PROTO_DIR)/control_plane.proto + $(PROTOC) -I $(PROTO_DIR) \ + --go_out=./proto/checkout --go_opt=paths=source_relative \ + --go-grpc_out=./proto/checkout --go-grpc_opt=paths=source_relative \ + $(PROTO_DIR)/checkout.proto @echo "$(GREEN)Protobuf generation complete.$(RESET)" clean_proto: @echo "$(YELLOW)Removing generated protobuf files...$(RESET)" - @rm -f $(PROTO_DIR)/*_grpc.pb.go $(PROTO_DIR)/*.pb.go - @rm -f *.pb.go + @rm -f $(PROTO_DIR)/cart/*_grpc.pb.go $(PROTO_DIR)/cart/*.pb.go + @rm -f $(PROTO_DIR)/control/*_grpc.pb.go $(PROTO_DIR)/control/*.pb.go + @rm -f $(PROTO_DIR)/checkout/*_grpc.pb.go $(PROTO_DIR)/checkout/*.pb.go @echo "$(GREEN)Clean complete.$(RESET)" verify_proto: @echo "$(YELLOW)Verifying proto layout...$(RESET)" @if ls *.pb.go >/dev/null 2>&1; then \ - echo "$(RED)ERROR: Found root-level generated *.pb.go files (should be only under $(PROTO_DIR)/).$(RESET)"; \ + echo "$(RED)ERROR: Found root-level generated *.pb.go files (should be only under $(PROTO_DIR)/ subdirs).$(RESET)"; \ ls -1 *.pb.go; \ exit 1; \ fi diff --git a/cmd/cart/k8s-host-discovery.go b/cmd/cart/k8s-host-discovery.go index c7d3d7a..b654bb8 100644 --- a/cmd/cart/k8s-host-discovery.go +++ b/cmd/cart/k8s-host-discovery.go @@ -6,6 +6,7 @@ import ( "git.k6n.net/go-cart-actor/pkg/actor" "git.k6n.net/go-cart-actor/pkg/cart" "git.k6n.net/go-cart-actor/pkg/discovery" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" ) @@ -24,7 +25,11 @@ func GetDiscovery() discovery.Discovery { if err != nil { log.Fatalf("Error creating client: %v\n", err) } - return discovery.NewK8sDiscovery(client) + timeout := int64(30) + return discovery.NewK8sDiscovery(client, v1.ListOptions{ + LabelSelector: "actor-pool=cart", + TimeoutSeconds: &timeout, + }) } func UseDiscovery(pool actor.GrainPool[*cart.CartGrain]) { diff --git a/cmd/cart/main.go b/cmd/cart/main.go index c6e66ec..bb9bec9 100644 --- a/cmd/cart/main.go +++ b/cmd/cart/main.go @@ -2,7 +2,6 @@ package main import ( "context" - "encoding/json" "fmt" "log" "net" @@ -15,12 +14,9 @@ import ( "git.k6n.net/go-cart-actor/pkg/actor" "git.k6n.net/go-cart-actor/pkg/cart" - messages "git.k6n.net/go-cart-actor/pkg/messages" "git.k6n.net/go-cart-actor/pkg/promotions" "git.k6n.net/go-cart-actor/pkg/proxy" "git.k6n.net/go-cart-actor/pkg/voucher" - "github.com/adyen/adyen-go-api-library/v21/src/adyen" - "github.com/adyen/adyen-go-api-library/v21/src/common" "github.com/matst80/go-redis-inventory/pkg/inventory" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" @@ -41,9 +37,8 @@ func init() { } type App struct { - pool *actor.SimpleGrainPool[cart.CartGrain] - server *PoolServer - klarnaClient *KlarnaClient + pool *actor.SimpleGrainPool[cart.CartGrain] + server *PoolServer } var podIp = os.Getenv("POD_IP") @@ -195,30 +190,16 @@ func main() { log.Fatalf("Error creating cart pool: %v\n", err) } - adyenClient := adyen.NewClient(&common.Config{ - ApiKey: os.Getenv("ADYEN_API_KEY"), - Environment: common.TestEnv, - }) - - klarnaClient := NewKlarnaClient(KlarnaPlaygroundUrl, os.Getenv("KLARNA_API_USERNAME"), os.Getenv("KLARNA_API_PASSWORD")) - - syncedServer := NewPoolServer(pool, fmt.Sprintf("%s, %s", name, podIp), klarnaClient, inventoryService, inventoryReservationService, adyenClient) + syncedServer := NewPoolServer(pool, fmt.Sprintf("%s, %s", name, podIp), inventoryService, inventoryReservationService) app := &App{ - pool: pool, - server: syncedServer, - klarnaClient: klarnaClient, + pool: pool, + server: syncedServer, } mux := http.NewServeMux() debugMux := http.NewServeMux() - if amqpUrl == "" { - log.Printf("no connection to amqp defined") - } else { - app.HandleCheckoutRequests(amqpUrl, mux, inventoryService) - } - grpcSrv, err := actor.NewControlServer[*cart.CartGrain](controlPlaneConfig, pool) if err != nil { log.Fatalf("Error starting control plane gRPC server: %v\n", err) @@ -331,31 +312,3 @@ func main() { } } - -func triggerOrderCompleted(ctx context.Context, syncedServer *PoolServer, order *CheckoutOrder) error { - mutation := &messages.OrderCreated{ - OrderId: order.ID, - Status: order.Status, - } - cid, ok := cart.ParseCartId(order.MerchantReference1) - if !ok { - return fmt.Errorf("invalid cart id in order reference: %s", order.MerchantReference1) - } - _, applyErr := syncedServer.Apply(ctx, uint64(cid), mutation) - - return applyErr -} - -func confirmOrder(ctx context.Context, order *CheckoutOrder, orderHandler *AmqpOrderHandler) error { - orderToSend, err := json.Marshal(order) - if err != nil { - return err - } - - err = orderHandler.OrderCompleted(orderToSend) - if err != nil { - return err - } - - return nil -} diff --git a/cmd/cart/pool-server.go b/cmd/cart/pool-server.go index 1894037..dd8a056 100644 --- a/cmd/cart/pool-server.go +++ b/cmd/cart/pool-server.go @@ -1,13 +1,11 @@ package main import ( - "bytes" "context" "encoding/json" - "fmt" + "io" "log" "net/http" - "net/url" "os" "strconv" "sync" @@ -15,15 +13,9 @@ import ( "git.k6n.net/go-cart-actor/pkg/actor" "git.k6n.net/go-cart-actor/pkg/cart" - messages "git.k6n.net/go-cart-actor/pkg/messages" - "git.k6n.net/go-cart-actor/pkg/proxy" + messages "git.k6n.net/go-cart-actor/proto/cart" + "git.k6n.net/go-cart-actor/pkg/voucher" - "github.com/adyen/adyen-go-api-library/v21/src/adyen" - "github.com/adyen/adyen-go-api-library/v21/src/checkout" - "github.com/adyen/adyen-go-api-library/v21/src/common" - "github.com/adyen/adyen-go-api-library/v21/src/hmacvalidator" - "github.com/adyen/adyen-go-api-library/v21/src/webhook" - "github.com/google/uuid" "github.com/matst80/go-redis-inventory/pkg/inventory" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" @@ -52,20 +44,16 @@ var ( type PoolServer struct { actor.GrainPool[*cart.CartGrain] pod_name string - klarnaClient *KlarnaClient - adyenClient *adyen.APIClient inventoryService inventory.InventoryService reservationService inventory.CartReservationService } -func NewPoolServer(pool actor.GrainPool[*cart.CartGrain], pod_name string, klarnaClient *KlarnaClient, inventoryService inventory.InventoryService, inventoryReservationService inventory.CartReservationService, adyenClient *adyen.APIClient) *PoolServer { +func NewPoolServer(pool actor.GrainPool[*cart.CartGrain], pod_name string, inventoryService inventory.InventoryService, inventoryReservationService inventory.CartReservationService) *PoolServer { srv := &PoolServer{ GrainPool: pool, pod_name: pod_name, - klarnaClient: klarnaClient, inventoryService: inventoryService, reservationService: inventoryReservationService, - adyenClient: adyenClient, } return srv @@ -130,71 +118,6 @@ func (s *PoolServer) DeleteItemHandler(w http.ResponseWriter, r *http.Request, i return s.WriteResult(w, data) } -type SetDeliveryRequest struct { - Provider string `json:"provider"` - Items []uint32 `json:"items"` - PickupPoint *messages.PickupPoint `json:"pickupPoint,omitempty"` -} - -func (s *PoolServer) SetDeliveryHandler(w http.ResponseWriter, r *http.Request, id cart.CartId) error { - - delivery := SetDeliveryRequest{} - err := json.NewDecoder(r.Body).Decode(&delivery) - if err != nil { - return err - } - data, err := s.ApplyLocal(r.Context(), id, &messages.SetDelivery{ - Provider: delivery.Provider, - Items: delivery.Items, - PickupPoint: delivery.PickupPoint, - }) - if err != nil { - return err - } - return s.WriteResult(w, data) -} - -func (s *PoolServer) SetPickupPointHandler(w http.ResponseWriter, r *http.Request, id cart.CartId) error { - - deliveryIdString := r.PathValue("deliveryId") - deliveryId, err := strconv.ParseInt(deliveryIdString, 10, 64) - if err != nil { - return err - } - pickupPoint := messages.PickupPoint{} - err = json.NewDecoder(r.Body).Decode(&pickupPoint) - if err != nil { - return err - } - reply, err := s.ApplyLocal(r.Context(), id, &messages.SetPickupPoint{ - DeliveryId: uint32(deliveryId), - Id: pickupPoint.Id, - Name: pickupPoint.Name, - Address: pickupPoint.Address, - City: pickupPoint.City, - Zip: pickupPoint.Zip, - Country: pickupPoint.Country, - }) - if err != nil { - return err - } - return s.WriteResult(w, reply) -} - -func (s *PoolServer) RemoveDeliveryHandler(w http.ResponseWriter, r *http.Request, id cart.CartId) error { - - deliveryIdString := r.PathValue("deliveryId") - deliveryId, err := strconv.Atoi(deliveryIdString) - if err != nil { - return err - } - reply, err := s.ApplyLocal(r.Context(), id, &messages.RemoveDelivery{Id: uint32(deliveryId)}) - if err != nil { - return err - } - return s.WriteResult(w, reply) -} - func (s *PoolServer) QuantityChangeHandler(w http.ResponseWriter, r *http.Request, id cart.CartId) error { changeQuantity := messages.ChangeQuantity{} err := json.NewDecoder(r.Body).Decode(&changeQuantity) @@ -379,45 +302,6 @@ func getClientIp(r *http.Request) string { return ip } -func (s *PoolServer) CreateOrUpdateCheckout(r *http.Request, id cart.CartId) (*CheckoutOrder, error) { - meta := GetCheckoutMetaFromRequest(r) - - // Get current grain state (may be local or remote) - grain, err := s.Get(r.Context(), uint64(id)) - if err != nil { - return nil, err - } - if s.inventoryService != nil { - inventoryRequests := getInventoryRequests(grain.Items) - failingRequest, err := s.inventoryService.ReservationCheck(r.Context(), inventoryRequests...) - if err != nil { - logger.WarnContext(r.Context(), "inventory check failed", string(failingRequest.SKU), string(failingRequest.LocationID)) - return nil, err - } - } - - // Build pure checkout payload - payload, _, err := BuildCheckoutOrderPayload(grain, meta) - if err != nil { - return nil, err - } - - if grain.OrderReference != "" { - return s.klarnaClient.UpdateOrder(r.Context(), grain.OrderReference, bytes.NewReader(payload)) - } else { - return s.klarnaClient.CreateOrder(r.Context(), bytes.NewReader(payload)) - } -} - -func (s *PoolServer) ApplyCheckoutStarted(ctx context.Context, klarnaOrder *CheckoutOrder, id cart.CartId) (*actor.MutationResult[*cart.CartGrain], error) { - // Persist initialization state via mutation (best-effort) - return s.ApplyLocal(ctx, id, &messages.InitializeCheckout{ - OrderId: klarnaOrder.ID, - Status: klarnaOrder.Status, - PaymentInProgress: true, - }) -} - // func (s *PoolServer) HandleCheckout(w http.ResponseWriter, r *http.Request, id CartId) error { // klarnaOrder, err := s.CreateOrUpdateCheckout(r.Host, id) // if err != nil { @@ -433,6 +317,7 @@ func (s *PoolServer) ApplyCheckoutStarted(ctx context.Context, klarnaOrder *Chec func CookieCartIdHandler(fn func(cartId cart.CartId, w http.ResponseWriter, r *http.Request) error) func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) { + var id cart.CartId cookie, err := r.Cookie("cartid") if err != nil || cookie.Value == "" { @@ -577,10 +462,6 @@ func (s *PoolServer) AddVoucherHandler(w http.ResponseWriter, r *http.Request, c v := voucher.Service{} msg, err := v.GetVoucher(data.VoucherCode) if err != nil { - s.ApplyLocal(r.Context(), cartId, &messages.PreConditionFailed{ - Operation: "AddVoucher", - Error: err.Error(), - }) w.WriteHeader(http.StatusInternalServerError) w.Write([]byte(err.Error())) return err @@ -629,26 +510,6 @@ func (s *PoolServer) SubscriptionDetailsHandler(w http.ResponseWriter, r *http.R return nil } -func (s *PoolServer) CheckoutHandler(fn func(order *CheckoutOrder, w http.ResponseWriter) error) func(w http.ResponseWriter, r *http.Request) { - return CookieCartIdHandler(s.ProxyHandler(func(w http.ResponseWriter, r *http.Request, cartId cart.CartId) error { - orderId := r.URL.Query().Get("order_id") - if orderId == "" { - order, err := s.CreateOrUpdateCheckout(r, cartId) - if err != nil { - logger.Error("unable to create klarna session", "error", err) - return err - } - s.ApplyCheckoutStarted(r.Context(), order, cartId) - return fn(order, w) - } - order, err := s.klarnaClient.GetOrder(r.Context(), orderId) - if err != nil { - return err - } - return fn(order, w) - })) -} - func (s *PoolServer) RemoveVoucherHandler(w http.ResponseWriter, r *http.Request, cartId cart.CartId) error { idStr := r.PathValue("voucherId") @@ -713,61 +574,27 @@ func (s *PoolServer) RemoveLineItemMarkingHandler(w http.ResponseWriter, r *http return s.WriteResult(w, reply) } -func (s *PoolServer) CreateCheckoutOrderHandler(w http.ResponseWriter, r *http.Request, cartId cart.CartId) error { - createCheckoutOrder := messages.CreateCheckoutOrder{} - err := json.NewDecoder(r.Body).Decode(&createCheckoutOrder) +func (s *PoolServer) InternalApplyMutationHandler(cartId cart.CartId, w http.ResponseWriter, r *http.Request) error { + if r.Method != http.MethodPost { + w.WriteHeader(http.StatusMethodNotAllowed) + return nil + } + data, err := io.ReadAll(r.Body) if err != nil { return err } - reply, err := s.ApplyLocal(r.Context(), cartId, &createCheckoutOrder) + mutation := &messages.Mutation{} + err = proto.Unmarshal(data, mutation) + if err != nil { + return err + } + reply, err := s.ApplyLocal(r.Context(), cartId, mutation) if err != nil { return err } return s.WriteResult(w, reply) } -type SessionRequest struct { - SessionId string `json:"sessionId"` - SessionResult string `json:"sessionResult"` - SessionData string `json:"sessionData,omitempty"` -} - -func (s *PoolServer) AdyenSessionHandler(w http.ResponseWriter, r *http.Request, cartId cart.CartId) error { - - grain, err := s.Get(r.Context(), uint64(cartId)) - if err != nil { - return err - } - if r.Method == http.MethodGet { - meta := GetCheckoutMetaFromRequest(r) - sessionData, err := BuildAdyenCheckoutSession(grain, meta) - if err != nil { - return err - } - service := s.adyenClient.Checkout() - req := service.PaymentsApi.SessionsInput().CreateCheckoutSessionRequest(*sessionData) - res, _, err := service.PaymentsApi.Sessions(r.Context(), req) - // apply checkout started - if err != nil { - return err - } - return s.WriteResult(w, res) - } else { - payload := &SessionRequest{} - if err := json.NewDecoder(r.Body).Decode(payload); err != nil { - return err - } - service := s.adyenClient.Checkout() - req := service.PaymentsApi.GetResultOfPaymentSessionInput(payload.SessionId).SessionResult(payload.SessionResult) - res, _, err := service.PaymentsApi.GetResultOfPaymentSession(r.Context(), req) - if err != nil { - return err - } - return s.WriteResult(w, res) - } - -} - func (s *PoolServer) GetAnywhere(ctx context.Context, cartId cart.CartId) (*cart.CartGrain, error) { id := uint64(cartId) if host, isOnOtherHost := s.OwnerHost(id); isOnOtherHost { @@ -789,164 +616,6 @@ func (s *PoolServer) ApplyAnywhere(ctx context.Context, cartId cart.CartId, msgs return err } -func (s *PoolServer) AdyenHookHandler(w http.ResponseWriter, r *http.Request) { - var notificationRequest webhook.Webhook - service := s.adyenClient.Checkout() - if err := json.NewDecoder(r.Body).Decode(¬ificationRequest); err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - cartHostMap := make(map[actor.Host][]webhook.NotificationItem) - for _, notificationItem := range *notificationRequest.NotificationItems { - item := notificationItem.NotificationRequestItem - log.Printf("Recieved notification event code: %s, %+v", item.EventCode, item) - - isValid := hmacvalidator.ValidateHmac(item, hmacKey) - if !isValid { - log.Printf("notification hmac not valid %s, %v", item.EventCode, item) - http.Error(w, "Invalid HMAC", http.StatusUnauthorized) - return - } else { - switch item.EventCode { - case "CAPTURE": - log.Printf("Capture status: %v", item.Success) - // dataBytes, err := json.Marshal(item) - // if err != nil { - // log.Printf("error marshaling item: %v", err) - // http.Error(w, "Error marshaling item", http.StatusInternalServerError) - // return - // } - //s.ApplyAnywhere(r.Context(),0, &messages.PaymentEvent{PaymentId: item.PspReference, Success: item.Success, Name: item.EventCode, Data: &pbany.Any{Value: dataBytes}}) - case "AUTHORISATION": - - cartId, ok := cart.ParseCartId(item.MerchantReference) - if !ok { - log.Printf("invalid cart id %s", item.MerchantReference) - http.Error(w, "Invalid cart id", http.StatusBadRequest) - return - } - //s.Apply() - - if host, ok := s.OwnerHost(uint64(cartId)); ok { - cartHostMap[host] = append(cartHostMap[host], notificationItem) - continue - } - - grain, err := s.Get(r.Context(), uint64(cartId)) - if err != nil { - log.Printf("Error getting cart: %v", err) - http.Error(w, "Cart not found", http.StatusBadRequest) - return - } - meta := GetCheckoutMetaFromRequest(r) - pspReference := item.PspReference - uid := uuid.New().String() - ref := uuid.New().String() - req := service.ModificationsApi.CaptureAuthorisedPaymentInput(pspReference).IdempotencyKey(uid).PaymentCaptureRequest(checkout.PaymentCaptureRequest{ - Amount: checkout.Amount{ - Currency: meta.Currency, - Value: grain.TotalPrice.IncVat, - }, - MerchantAccount: "ElgigantenECOM", - Reference: &ref, - }) - res, _, err := service.ModificationsApi.CaptureAuthorisedPayment(r.Context(), req) - if err != nil { - log.Printf("Error capturing payment: %v", err) - } else { - log.Printf("Payment captured successfully: %+v", res) - s.Apply(r.Context(), uint64(cartId), &messages.OrderCreated{ - OrderId: res.PaymentPspReference, - Status: item.EventCode, - }) - } - default: - log.Printf("Unknown event code: %s", item.EventCode) - } - } - } - var failed bool = false - var lastMock *proxy.MockResponseWriter - for host, items := range cartHostMap { - notificationRequest.NotificationItems = &items - bodyBytes, err := json.Marshal(notificationRequest) - if err != nil { - log.Printf("error marshaling notification: %+v", err) - continue - } - customBody := bytes.NewReader(bodyBytes) - mockW := proxy.NewMockResponseWriter() - handled, err := host.Proxy(0, mockW, r, customBody) - if err != nil { - log.Printf("proxy failed for %s: %+v", host.Name(), err) - failed = true - lastMock = mockW - } else if handled { - log.Printf("notification proxied to %s", host.Name()) - } - } - if failed { - w.WriteHeader(lastMock.StatusCode) - w.Write(lastMock.Body.Bytes()) - } else { - w.WriteHeader(http.StatusAccepted) - } -} - -func (s *PoolServer) AdyenReturnHandler(w http.ResponseWriter, r *http.Request) { - log.Println("Redirect received") - - service := s.adyenClient.Checkout() - - req := service.PaymentsApi.GetResultOfPaymentSessionInput(r.URL.Query().Get("sessionId")) - - res, httpRes, err := service.PaymentsApi.GetResultOfPaymentSession(r.Context(), req) - log.Printf("got payment session %+v", res) - - dreq := service.PaymentsApi.PaymentsDetailsInput() - dreq = dreq.PaymentDetailsRequest(checkout.PaymentDetailsRequest{ - Details: checkout.PaymentCompletionDetails{ - RedirectResult: common.PtrString(r.URL.Query().Get("redirectResult")), - Payload: common.PtrString(r.URL.Query().Get("payload")), - }, - }) - - dres, httpRes, err := service.PaymentsApi.PaymentsDetails(r.Context(), dreq) - - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - log.Printf("Payment details response: %+v", dres) - - if !common.IsNil(dres.PspReference) && *dres.PspReference != "" { - var redirectURL string - // Conditionally handle different result codes for the shopper - switch *dres.ResultCode { - case "Authorised": - redirectURL = "/result/success" - case "Pending", "Received": - redirectURL = "/result/pending" - case "Refused": - redirectURL = "/result/failed" - default: - reason := "" - if dres.RefusalReason != nil { - reason = *dres.RefusalReason - } else { - reason = *dres.ResultCode - } - log.Printf("Payment failed: %s", reason) - redirectURL = fmt.Sprintf("/result/error?reason=%s", url.QueryEscape(reason)) - } - http.Redirect(w, r, redirectURL, http.StatusFound) - return - } - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(httpRes.StatusCode) - json.NewEncoder(w).Encode(httpRes.Status) -} - func (s *PoolServer) Serve(mux *http.ServeMux) { // mux.HandleFunc("OPTIONS /cart", func(w http.ResponseWriter, r *http.Request) { @@ -970,9 +639,6 @@ func (s *PoolServer) Serve(mux *http.ServeMux) { })) } - handleFunc("/adyen_hook", s.AdyenHookHandler) - handleFunc("/adyen-return", s.AdyenReturnHandler) - handleFunc("GET /cart", CookieCartIdHandler(s.ProxyHandler(s.GetCartHandler))) handleFunc("GET /cart/add/{sku}", CookieCartIdHandler(s.ProxyHandler(s.AddSkuToCartHandler))) handleFunc("POST /cart/add", CookieCartIdHandler(s.ProxyHandler(s.AddMultipleItemHandler))) @@ -981,38 +647,27 @@ func (s *PoolServer) Serve(mux *http.ServeMux) { handleFunc("DELETE /cart/{itemId}", CookieCartIdHandler(s.ProxyHandler(s.DeleteItemHandler))) handleFunc("PUT /cart", CookieCartIdHandler(s.ProxyHandler(s.QuantityChangeHandler))) handleFunc("DELETE /cart", CookieCartIdHandler(s.ProxyHandler(s.RemoveCartCookie))) - handleFunc("POST /cart/delivery", CookieCartIdHandler(s.ProxyHandler(s.SetDeliveryHandler))) - handleFunc("DELETE /cart/delivery/{deliveryId}", CookieCartIdHandler(s.ProxyHandler(s.RemoveDeliveryHandler))) - handleFunc("PUT /cart/delivery/{deliveryId}/pickupPoint", CookieCartIdHandler(s.ProxyHandler(s.SetPickupPointHandler))) handleFunc("PUT /cart/voucher", CookieCartIdHandler(s.ProxyHandler(s.AddVoucherHandler))) handleFunc("PUT /cart/subscription-details", CookieCartIdHandler(s.ProxyHandler(s.SubscriptionDetailsHandler))) handleFunc("DELETE /cart/voucher/{voucherId}", CookieCartIdHandler(s.ProxyHandler(s.RemoveVoucherHandler))) handleFunc("PUT /cart/user", CookieCartIdHandler(s.ProxyHandler(s.SetUserIdHandler))) - handleFunc("GET /cart/adyen-session", CookieCartIdHandler(s.ProxyHandler(s.AdyenSessionHandler))) + handleFunc("PUT /cart/item/{itemId}/marking", CookieCartIdHandler(s.ProxyHandler(s.LineItemMarkingHandler))) handleFunc("DELETE /cart/item/{itemId}/marking", CookieCartIdHandler(s.ProxyHandler(s.RemoveLineItemMarkingHandler))) - handleFunc("POST /cart/checkout-order", CookieCartIdHandler(s.ProxyHandler(s.CreateCheckoutOrderHandler))) - //mux.HandleFunc("GET /cart/checkout", CookieCartIdHandler(s.ProxyHandler(s.HandleCheckout))) //mux.HandleFunc("GET /cart/confirmation/{orderId}", CookieCartIdHandler(s.ProxyHandler(s.HandleConfirmation))) handleFunc("GET /cart/byid/{id}", CartIdHandler(s.ProxyHandler(s.GetCartHandler))) - handleFunc("GET /cart/byid/{id}/add/{sku}", CartIdHandler(s.ProxyHandler(s.AddSkuToCartHandler))) + handleFunc("POST /cart/byid/{id}", CartIdHandler(s.ProxyHandler(s.AddSkuRequestHandler))) handleFunc("DELETE /cart/byid/{id}/{itemId}", CartIdHandler(s.ProxyHandler(s.DeleteItemHandler))) handleFunc("PUT /cart/byid/{id}", CartIdHandler(s.ProxyHandler(s.QuantityChangeHandler))) - handleFunc("POST /cart/byid/{id}/delivery", CartIdHandler(s.ProxyHandler(s.SetDeliveryHandler))) - handleFunc("DELETE /cart/byid/{id}/delivery/{deliveryId}", CartIdHandler(s.ProxyHandler(s.RemoveDeliveryHandler))) - handleFunc("PUT /cart/byid/{id}/delivery/{deliveryId}/pickupPoint", CartIdHandler(s.ProxyHandler(s.SetPickupPointHandler))) handleFunc("PUT /cart/byid/{id}/voucher", CookieCartIdHandler(s.ProxyHandler(s.AddVoucherHandler))) handleFunc("DELETE /cart/byid/{id}/voucher/{voucherId}", CookieCartIdHandler(s.ProxyHandler(s.RemoveVoucherHandler))) handleFunc("PUT /cart/byid/{id}/user", CartIdHandler(s.ProxyHandler(s.SetUserIdHandler))) handleFunc("PUT /cart/byid/{id}/item/{itemId}/marking", CartIdHandler(s.ProxyHandler(s.LineItemMarkingHandler))) handleFunc("DELETE /cart/byid/{id}/item/{itemId}/marking", CartIdHandler(s.ProxyHandler(s.RemoveLineItemMarkingHandler))) - handleFunc("POST /cart/byid/{id}/checkout-order", CartIdHandler(s.ProxyHandler(s.CreateCheckoutOrderHandler))) - //mux.HandleFunc("GET /cart/byid/{id}/checkout", CartIdHandler(s.ProxyHandler(s.HandleCheckout))) - //mux.HandleFunc("GET /cart/byid/{id}/confirmation", CartIdHandler(s.ProxyHandler(s.HandleConfirmation))) - + handleFunc("POST /internal/cart/{id}/mutation", CartIdHandler(s.InternalApplyMutationHandler)) } diff --git a/cmd/cart/product-fetcher.go b/cmd/cart/product-fetcher.go index 023eef6..12a9904 100644 --- a/cmd/cart/product-fetcher.go +++ b/cmd/cart/product-fetcher.go @@ -7,7 +7,8 @@ import ( "net/http" "git.k6n.net/go-cart-actor/pkg/cart" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" + "github.com/matst80/slask-finder/pkg/index" ) diff --git a/cmd/cart/amqp-order-handler.go b/cmd/checkout/amqp-order-handler.go similarity index 100% rename from cmd/cart/amqp-order-handler.go rename to cmd/checkout/amqp-order-handler.go diff --git a/cmd/cart/checkout_builder.go b/cmd/checkout/checkout_builder.go similarity index 82% rename from cmd/cart/checkout_builder.go rename to cmd/checkout/checkout_builder.go index def5eda..473a008 100644 --- a/cmd/cart/checkout_builder.go +++ b/cmd/checkout/checkout_builder.go @@ -6,7 +6,8 @@ import ( "net/http" "git.k6n.net/go-cart-actor/pkg/cart" - "github.com/adyen/adyen-go-api-library/v21/src/checkout" + "git.k6n.net/go-cart-actor/pkg/checkout" + adyenCheckout "github.com/adyen/adyen-go-api-library/v21/src/checkout" "github.com/adyen/adyen-go-api-library/v21/src/common" ) @@ -38,7 +39,7 @@ type CheckoutMeta struct { // // If you later need to support different tax rates per line, you can extend // CartItem / Delivery to expose that data and propagate it here. -func BuildCheckoutOrderPayload(grain *cart.CartGrain, meta *CheckoutMeta) ([]byte, *CheckoutOrder, error) { +func BuildCheckoutOrderPayload(grain *checkout.CheckoutGrain, meta *CheckoutMeta) ([]byte, *CheckoutOrder, error) { if grain == nil { return nil, nil, fmt.Errorf("nil grain") } @@ -59,10 +60,10 @@ func BuildCheckoutOrderPayload(grain *cart.CartGrain, meta *CheckoutMeta) ([]byt country = "SE" // sensible default; adjust if multi-country support changes } - lines := make([]*Line, 0, len(grain.Items)+len(grain.Deliveries)) + lines := make([]*Line, 0, len(grain.CartState.Items)+len(grain.Deliveries)) // Item lines - for _, it := range grain.Items { + for _, it := range grain.CartState.Items { if it == nil { continue } @@ -80,11 +81,15 @@ func BuildCheckoutOrderPayload(grain *cart.CartGrain, meta *CheckoutMeta) ([]byt }) } + total := cart.NewPrice() + total.Add(*grain.CartState.TotalPrice) + // Delivery lines for _, d := range grain.Deliveries { if d == nil || d.Price.IncVat <= 0 { continue } + //total.Add(d.Price) lines = append(lines, &Line{ Type: "shipping_fee", Reference: d.Provider, @@ -102,8 +107,8 @@ func BuildCheckoutOrderPayload(grain *cart.CartGrain, meta *CheckoutMeta) ([]byt PurchaseCountry: country, PurchaseCurrency: currency, Locale: locale, - OrderAmount: int(grain.TotalPrice.IncVat), - OrderTaxAmount: int(grain.TotalPrice.TotalVat()), + OrderAmount: int(total.IncVat), + OrderTaxAmount: int(total.TotalVat()), OrderLines: lines, MerchantReference1: grain.Id.String(), MerchantURLS: &CheckoutMerchantURLS{ @@ -136,7 +141,7 @@ func GetCheckoutMetaFromRequest(r *http.Request) *CheckoutMeta { } } -func BuildAdyenCheckoutSession(grain *cart.CartGrain, meta *CheckoutMeta) (*checkout.CreateCheckoutSessionRequest, error) { +func BuildAdyenCheckoutSession(grain *checkout.CheckoutGrain, meta *CheckoutMeta) (*adyenCheckout.CreateCheckoutSessionRequest, error) { if grain == nil { return nil, fmt.Errorf("nil grain") } @@ -153,14 +158,14 @@ func BuildAdyenCheckoutSession(grain *cart.CartGrain, meta *CheckoutMeta) (*chec country = "SE" } - lineItems := make([]checkout.LineItem, 0, len(grain.Items)+len(grain.Deliveries)) + lineItems := make([]adyenCheckout.LineItem, 0, len(grain.CartState.Items)+len(grain.Deliveries)) // Item lines - for _, it := range grain.Items { + for _, it := range grain.CartState.Items { if it == nil { continue } - lineItems = append(lineItems, checkout.LineItem{ + lineItems = append(lineItems, adyenCheckout.LineItem{ Quantity: common.PtrInt64(int64(it.Quantity)), AmountIncludingTax: common.PtrInt64(it.TotalPrice.IncVat), Description: common.PtrString(it.Meta.Name), @@ -169,13 +174,15 @@ func BuildAdyenCheckoutSession(grain *cart.CartGrain, meta *CheckoutMeta) (*chec TaxPercentage: common.PtrInt64(int64(it.Tax)), }) } + total := cart.NewPrice() + total.Add(*grain.CartState.TotalPrice) // Delivery lines for _, d := range grain.Deliveries { if d == nil || d.Price.IncVat <= 0 { continue } - lineItems = append(lineItems, checkout.LineItem{ + lineItems = append(lineItems, adyenCheckout.LineItem{ Quantity: common.PtrInt64(1), AmountIncludingTax: common.PtrInt64(d.Price.IncVat), Description: common.PtrString("Delivery"), @@ -184,10 +191,10 @@ func BuildAdyenCheckoutSession(grain *cart.CartGrain, meta *CheckoutMeta) (*chec }) } - return &checkout.CreateCheckoutSessionRequest{ + return &adyenCheckout.CreateCheckoutSessionRequest{ Reference: grain.Id.String(), - Amount: checkout.Amount{ - Value: grain.TotalPrice.IncVat, + Amount: adyenCheckout.Amount{ + Value: total.IncVat, Currency: currency, }, CountryCode: common.PtrString(country), diff --git a/cmd/cart/checkout_server.go b/cmd/checkout/checkout_server.go similarity index 80% rename from cmd/cart/checkout_server.go rename to cmd/checkout/checkout_server.go index 730df40..0a7e258 100644 --- a/cmd/cart/checkout_server.go +++ b/cmd/checkout/checkout_server.go @@ -8,9 +8,9 @@ import ( "net/http" "time" - "git.k6n.net/go-cart-actor/pkg/actor" "git.k6n.net/go-cart-actor/pkg/cart" - "git.k6n.net/go-cart-actor/pkg/messages" + "git.k6n.net/go-cart-actor/pkg/checkout" + messages "git.k6n.net/go-cart-actor/proto/checkout" "github.com/matst80/go-redis-inventory/pkg/inventory" amqp "github.com/rabbitmq/amqp091-go" @@ -30,7 +30,31 @@ var tpl = ` ` -func (a *App) getGrainFromOrder(ctx context.Context, order *CheckoutOrder) (*cart.CartGrain, error) { +func getLocationId(item *cart.CartItem) inventory.LocationID { + if item.StoreId == nil || *item.StoreId == "" { + return "se" + } + return inventory.LocationID(*item.StoreId) +} + +func getInventoryRequests(items []*cart.CartItem) []inventory.ReserveRequest { + var requests []inventory.ReserveRequest + for _, item := range items { + if item == nil { + continue + } + requests = append(requests, inventory.ReserveRequest{ + InventoryReference: &inventory.InventoryReference{ + SKU: inventory.SKU(item.Sku), + LocationID: getLocationId(item), + }, + Quantity: uint32(item.Quantity), + }) + } + return requests +} + +func (a *App) getGrainFromOrder(ctx context.Context, order *CheckoutOrder) (*checkout.CheckoutGrain, error) { cartId, ok := cart.ParseCartId(order.MerchantReference1) if !ok { return nil, fmt.Errorf("invalid cart id in order reference: %s", order.MerchantReference1) @@ -48,14 +72,6 @@ func (a *App) HandleCheckoutRequests(amqpUrl string, mux *http.ServeMux, invento log.Fatalf("failed to connect to RabbitMQ: %v", err) } - amqpListener := actor.NewAmqpListener(conn, func(id uint64, msg []actor.ApplyResult) (any, error) { - return &CartChangeEvent{ - CartId: cart.CartId(id), - Mutations: msg, - }, nil - }) - amqpListener.DefineTopics() - a.pool.AddListener(amqpListener) orderHandler := NewAmqpOrderHandler(conn) orderHandler.DefineQueue() @@ -84,7 +100,7 @@ func (a *App) HandleCheckoutRequests(amqpUrl string, mux *http.ServeMux, invento } if inventoryService != nil { - inventoryRequests := getInventoryRequests(grain.Items) + inventoryRequests := getInventoryRequests(grain.CartState.Items) err = inventoryService.ReserveInventory(r.Context(), inventoryRequests...) if err != nil { @@ -98,19 +114,19 @@ func (a *App) HandleCheckoutRequests(amqpUrl string, mux *http.ServeMux, invento }) } - err = confirmOrder(r.Context(), order, orderHandler) - if err != nil { - log.Printf("Error confirming order: %v\n", err) - w.WriteHeader(http.StatusInternalServerError) - return - } + // err = confirmOrder(r.Context(), order, orderHandler) + // if err != nil { + // log.Printf("Error confirming order: %v\n", err) + // w.WriteHeader(http.StatusInternalServerError) + // return + // } - err = triggerOrderCompleted(r.Context(), a.server, order) - if err != nil { - log.Printf("Error processing cart message: %v\n", err) - w.WriteHeader(http.StatusInternalServerError) - return - } + // err = triggerOrderCompleted(r.Context(), a.server, order) + // if err != nil { + // log.Printf("Error processing cart message: %v\n", err) + // w.WriteHeader(http.StatusInternalServerError) + // return + // } err = a.klarnaClient.AcknowledgeOrder(r.Context(), orderId) if err != nil { log.Printf("Error acknowledging order: %v\n", err) @@ -196,7 +212,7 @@ func (a *App) HandleCheckoutRequests(amqpUrl string, mux *http.ServeMux, invento return } if inventoryService != nil { - inventoryRequests := getInventoryRequests(grain.Items) + inventoryRequests := getInventoryRequests(grain.CartState.Items) _, err = inventoryService.ReservationCheck(r.Context(), inventoryRequests...) if err != nil { logger.WarnContext(r.Context(), "placeorder inventory check failed") diff --git a/cmd/checkout/k8s-host-discovery.go b/cmd/checkout/k8s-host-discovery.go new file mode 100644 index 0000000..34170e5 --- /dev/null +++ b/cmd/checkout/k8s-host-discovery.go @@ -0,0 +1,65 @@ +package main + +import ( + "log" + + "git.k6n.net/go-cart-actor/pkg/actor" + "git.k6n.net/go-cart-actor/pkg/checkout" + "git.k6n.net/go-cart-actor/pkg/discovery" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" +) + +func GetDiscovery() discovery.Discovery { + if podIp == "" { + return nil + } + + config, kerr := rest.InClusterConfig() + + if kerr != nil { + log.Fatalf("Error creating kubernetes client: %v\n", kerr) + } + client, err := kubernetes.NewForConfig(config) + if err != nil { + log.Fatalf("Error creating client: %v\n", err) + } + timeout := int64(30) + return discovery.NewK8sDiscovery(client, v1.ListOptions{ + LabelSelector: "actor-pool=checkout", + TimeoutSeconds: &timeout, + }) +} + +func UseDiscovery(pool actor.GrainPool[*checkout.CheckoutGrain]) { + + go func(hw discovery.Discovery) { + if hw == nil { + log.Print("No discovery service available") + return + } + ch, err := hw.Watch() + if err != nil { + log.Printf("Discovery error: %v", err) + return + } + for evt := range ch { + if evt.Host == "" { + continue + } + switch evt.IsReady { + case false: + if pool.IsKnown(evt.Host) { + log.Printf("Host %s is not ready, removing", evt.Host) + pool.RemoveHost(evt.Host) + } + default: + if !pool.IsKnown(evt.Host) { + log.Printf("Discovered host %s", evt.Host) + pool.AddRemoteHost(evt.Host) + } + } + } + }(GetDiscovery()) +} diff --git a/cmd/cart/klarna-client.go b/cmd/checkout/klarna-client.go similarity index 100% rename from cmd/cart/klarna-client.go rename to cmd/checkout/klarna-client.go diff --git a/cmd/cart/klarna-types.go b/cmd/checkout/klarna-types.go similarity index 100% rename from cmd/cart/klarna-types.go rename to cmd/checkout/klarna-types.go diff --git a/cmd/checkout/main.go b/cmd/checkout/main.go new file mode 100644 index 0000000..c5f8fc8 --- /dev/null +++ b/cmd/checkout/main.go @@ -0,0 +1,252 @@ +package main + +import ( + "bytes" + "context" + "fmt" + "log" + "net" + "net/http" + "os" + "os/signal" + "strings" + "time" + + "git.k6n.net/go-cart-actor/pkg/actor" + "git.k6n.net/go-cart-actor/pkg/cart" + "git.k6n.net/go-cart-actor/pkg/checkout" + "git.k6n.net/go-cart-actor/pkg/proxy" + "github.com/adyen/adyen-go-api-library/v21/src/adyen" + "github.com/adyen/adyen-go-api-library/v21/src/common" + "github.com/gogo/protobuf/proto" + "github.com/matst80/go-redis-inventory/pkg/inventory" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" + "github.com/redis/go-redis/v9" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" +) + +var ( + grainSpawns = promauto.NewCounter(prometheus.CounterOpts{ + Name: "checkout_grain_spawned_total", + Help: "The total number of spawned checkout grains", + }) +) + +func init() { + os.Mkdir("data", 0755) +} + +type App struct { + pool *actor.SimpleGrainPool[checkout.CheckoutGrain] + server *CheckoutPoolServer + klarnaClient *KlarnaClient + cartClient *CartClient // For internal communication to cart +} + +var podIp = os.Getenv("POD_IP") +var name = os.Getenv("POD_NAME") +var amqpUrl = os.Getenv("AMQP_URL") +var redisAddress = os.Getenv("REDIS_ADDRESS") +var redisPassword = os.Getenv("REDIS_PASSWORD") +var cartInternalUrl = os.Getenv("CART_INTERNAL_URL") // e.g., http://cart-service:8081 + +func getCountryFromHost(host string) string { + if strings.Contains(strings.ToLower(host), "-no") { + return "no" + } + if strings.Contains(strings.ToLower(host), "-se") { + return "se" + } + return "" +} + +type CartClient struct { + httpClient *http.Client + baseUrl string +} + +func NewCartClient(baseUrl string) *CartClient { + return &CartClient{ + httpClient: &http.Client{Timeout: 10 * time.Second}, + baseUrl: baseUrl, + } +} + +func (c *CartClient) ApplyMutation(cartId cart.CartId, mutation proto.Message) error { + url := fmt.Sprintf("%s/internal/cart/%s/mutation", c.baseUrl, cartId.String()) + data, err := proto.Marshal(mutation) + if err != nil { + return err + } + req, err := http.NewRequest("POST", url, bytes.NewReader(data)) + if err != nil { + return err + } + req.Header.Set("Content-Type", "application/protobuf") + resp, err := c.httpClient.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("cart mutation failed: %s", resp.Status) + } + return nil +} + +func main() { + + controlPlaneConfig := actor.DefaultServerConfig() + + reg := checkout.NewCheckoutMutationRegistry(checkout.NewCheckoutMutationContext()) + reg.RegisterProcessor( + actor.NewMutationProcessor(func(ctx context.Context, g *checkout.CheckoutGrain) error { + g.Version++ + return nil + }), + ) + rdb := redis.NewClient(&redis.Options{ + Addr: redisAddress, + Password: redisPassword, + DB: 0, + }) + inventoryService, err := inventory.NewRedisInventoryService(rdb) + if err != nil { + log.Fatalf("Error creating inventory service: %v\n", err) + } + + diskStorage := actor.NewDiskStorage[checkout.CheckoutGrain]("data", reg) + + poolConfig := actor.GrainPoolConfig[checkout.CheckoutGrain]{ + MutationRegistry: reg, + Storage: diskStorage, + Spawn: func(ctx context.Context, id uint64) (actor.Grain[checkout.CheckoutGrain], error) { + _, span := tracer.Start(ctx, fmt.Sprintf("Spawn checkout id %d", id)) + defer span.End() + grainSpawns.Inc() + + ret := checkout.NewCheckoutGrain(id, 0, 0, time.Now(), nil) // version to be set later + return ret, nil + }, + Destroy: func(grain actor.Grain[checkout.CheckoutGrain]) error { + return nil + }, + SpawnHost: func(host string) (actor.Host, error) { + return proxy.NewRemoteHost[checkout.CheckoutGrain](host) + }, + TTL: 1 * time.Hour, // Longer TTL for checkout + PoolSize: 65535, + Hostname: podIp, + } + + pool, err := actor.NewSimpleGrainPool(poolConfig) + if err != nil { + log.Fatalf("Error creating checkout pool: %v\n", err) + } + + adyenClient := adyen.NewClient(&common.Config{ + ApiKey: os.Getenv("ADYEN_API_KEY"), + Environment: common.TestEnv, + }) + + klarnaClient := NewKlarnaClient(KlarnaPlaygroundUrl, os.Getenv("KLARNA_API_USERNAME"), os.Getenv("KLARNA_API_PASSWORD")) + + cartClient := NewCartClient(cartInternalUrl) + + syncedServer := NewCheckoutPoolServer(pool, fmt.Sprintf("%s, %s", name, podIp), klarnaClient, cartClient, adyenClient) + + app := &App{ + pool: pool, + server: syncedServer, + klarnaClient: klarnaClient, + cartClient: cartClient, + } + + mux := http.NewServeMux() + debugMux := http.NewServeMux() + + if amqpUrl == "" { + log.Printf("no connection to amqp defined") + } else { + app.HandleCheckoutRequests(amqpUrl, mux, inventoryService) + } + + grpcSrv, err := actor.NewControlServer[*checkout.CheckoutGrain](controlPlaneConfig, pool) + if err != nil { + log.Fatalf("Error starting control plane gRPC server: %v\n", err) + } + defer grpcSrv.GracefulStop() + + UseDiscovery(pool) + + ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) + defer stop() + + otelShutdown, err := setupOTelSDK(ctx) + if err != nil { + log.Fatalf("Unable to start otel %v", err) + } + + syncedServer.Serve(mux) + + mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { + grainCount, capacity := app.pool.LocalUsage() + if grainCount >= capacity { + w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte("grain pool at capacity")) + return + } + if !pool.IsHealthy() { + w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte("control plane not healthy")) + return + } + w.WriteHeader(http.StatusOK) + w.Write([]byte("ok")) + }) + mux.HandleFunc("/readyz", func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + w.Write([]byte("ok")) + }) + mux.HandleFunc("/livez", func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + w.Write([]byte("ok")) + }) + + mux.HandleFunc("/version", func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + w.Write([]byte("1.0.0")) + }) + + srv := &http.Server{ + Addr: ":8080", + BaseContext: func(net.Listener) context.Context { return ctx }, + ReadTimeout: 10 * time.Second, + WriteTimeout: 20 * time.Second, + Handler: otelhttp.NewHandler(mux, "/"), + } + + defer func() { + fmt.Println("Shutting down due to signal") + otelShutdown(context.Background()) + diskStorage.Close() + pool.Close() + }() + + srvErr := make(chan error, 1) + go func() { + srvErr <- srv.ListenAndServe() + }() + + log.Print("Checkout server started at port 8080") + + go http.ListenAndServe(":8081", debugMux) + + select { + case err = <-srvErr: + log.Fatalf("Unable to start server: %v", err) + case <-ctx.Done(): + stop() + } +} diff --git a/cmd/checkout/otel.go b/cmd/checkout/otel.go new file mode 100644 index 0000000..b1891bc --- /dev/null +++ b/cmd/checkout/otel.go @@ -0,0 +1,117 @@ +package main + +import ( + "context" + "errors" + "time" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" + "go.opentelemetry.io/otel/log/global" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/sdk/log" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/trace" +) + +// setupOTelSDK bootstraps the OpenTelemetry pipeline. +// If it does not return an error, make sure to call shutdown for proper cleanup. +func setupOTelSDK(ctx context.Context) (func(context.Context) error, error) { + var shutdownFuncs []func(context.Context) error + var err error + + // shutdown calls cleanup functions registered via shutdownFuncs. + // The errors from the calls are joined. + // Each registered cleanup will be invoked once. + shutdown := func(ctx context.Context) error { + var err error + for _, fn := range shutdownFuncs { + err = errors.Join(err, fn(ctx)) + } + shutdownFuncs = nil + return err + } + + // handleErr calls shutdown for cleanup and makes sure that all errors are returned. + handleErr := func(inErr error) { + err = errors.Join(inErr, shutdown(ctx)) + } + + // Set up propagator. + prop := newPropagator() + otel.SetTextMapPropagator(prop) + + // Set up trace provider. + tracerProvider, err := newTracerProvider() + if err != nil { + handleErr(err) + return shutdown, err + } + shutdownFuncs = append(shutdownFuncs, tracerProvider.Shutdown) + otel.SetTracerProvider(tracerProvider) + + // Set up meter provider. + meterProvider, err := newMeterProvider() + if err != nil { + handleErr(err) + return shutdown, err + } + shutdownFuncs = append(shutdownFuncs, meterProvider.Shutdown) + otel.SetMeterProvider(meterProvider) + + // Set up logger provider. + loggerProvider, err := newLoggerProvider() + if err != nil { + handleErr(err) + return shutdown, err + } + shutdownFuncs = append(shutdownFuncs, loggerProvider.Shutdown) + global.SetLoggerProvider(loggerProvider) + + return shutdown, err +} + +func newPropagator() propagation.TextMapPropagator { + return propagation.NewCompositeTextMapPropagator( + propagation.TraceContext{}, + propagation.Baggage{}, + ) +} + +func newTracerProvider() (*trace.TracerProvider, error) { + traceExporter, err := otlptracegrpc.New(context.Background()) + if err != nil { + return nil, err + } + + tracerProvider := trace.NewTracerProvider( + trace.WithBatcher(traceExporter, + // Default is 5s. Set to 1s for demonstrative purposes. + trace.WithBatchTimeout(time.Second)), + ) + return tracerProvider, nil +} + +func newMeterProvider() (*metric.MeterProvider, error) { + exporter, err := otlpmetricgrpc.New(context.Background()) + if err != nil { + return nil, err + } + + provider := metric.NewMeterProvider(metric.WithReader(metric.NewPeriodicReader(exporter))) + return provider, nil +} + +func newLoggerProvider() (*log.LoggerProvider, error) { + logExporter, err := otlploggrpc.New(context.Background()) + if err != nil { + return nil, err + } + + loggerProvider := log.NewLoggerProvider( + log.WithProcessor(log.NewBatchProcessor(logExporter)), + ) + return loggerProvider, nil +} diff --git a/cmd/checkout/pool-server.go b/cmd/checkout/pool-server.go new file mode 100644 index 0000000..bd10f0b --- /dev/null +++ b/cmd/checkout/pool-server.go @@ -0,0 +1,320 @@ +package main + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "log" + "net/http" + "os" + "time" + + "git.k6n.net/go-cart-actor/pkg/actor" + "git.k6n.net/go-cart-actor/pkg/cart" + "git.k6n.net/go-cart-actor/pkg/checkout" + messages "git.k6n.net/go-cart-actor/proto/checkout" + + adyen "github.com/adyen/adyen-go-api-library/v21/src/adyen" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" + "go.opentelemetry.io/contrib/bridges/otelslog" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/timestamppb" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/trace" +) + +func getOriginalHost(r *http.Request) string { + proxyHost := r.Header.Get("X-Forwarded-Host") + if proxyHost != "" { + return proxyHost + } + return r.Host +} + +func getClientIp(r *http.Request) string { + ip := r.Header.Get("X-Forwarded-For") + if ip == "" { + ip = r.RemoteAddr + } + return ip +} + +func getCurrency(country string) string { + if country == "no" { + return "NOK" + } + return "SEK" +} + +func getLocale(country string) string { + if country == "no" { + return "nb-no" + } + return "sv-se" +} + +var ( + grainMutations = promauto.NewCounter(prometheus.CounterOpts{ + Name: "checkout_grain_mutations_total", + Help: "The total number of mutations", + }) + grainLookups = promauto.NewCounter(prometheus.CounterOpts{ + Name: "checkout_grain_lookups_total", + Help: "The total number of lookups", + }) +) + +type CheckoutPoolServer struct { + actor.GrainPool[*checkout.CheckoutGrain] + pod_name string + klarnaClient *KlarnaClient + adyenClient *adyen.APIClient + cartClient *CartClient +} + +func NewCheckoutPoolServer(pool actor.GrainPool[*checkout.CheckoutGrain], pod_name string, klarnaClient *KlarnaClient, cartClient *CartClient, adyenClient *adyen.APIClient) *CheckoutPoolServer { + srv := &CheckoutPoolServer{ + GrainPool: pool, + pod_name: pod_name, + klarnaClient: klarnaClient, + cartClient: cartClient, + adyenClient: adyenClient, + } + + return srv +} + +func (s *CheckoutPoolServer) ApplyLocal(ctx context.Context, id checkout.CheckoutId, mutation ...proto.Message) (*actor.MutationResult[*checkout.CheckoutGrain], error) { + return s.Apply(ctx, uint64(id), mutation...) +} + +func (s *CheckoutPoolServer) GetCheckoutHandler(w http.ResponseWriter, r *http.Request, id checkout.CheckoutId) error { + grain, err := s.Get(r.Context(), uint64(id)) + if err != nil { + return err + } + + return s.WriteResult(w, grain) +} + +func (s *CheckoutPoolServer) WriteResult(w http.ResponseWriter, result any) error { + w.Header().Set("Content-Type", "application/json") + w.Header().Set("Cache-Control", "no-cache") + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("X-Pod-Name", s.pod_name) + if result == nil { + + w.WriteHeader(http.StatusInternalServerError) + + return nil + } + w.WriteHeader(http.StatusOK) + enc := json.NewEncoder(w) + err := enc.Encode(result) + return err +} + +func (s *CheckoutPoolServer) CreateOrUpdateCheckout(r *http.Request, id checkout.CheckoutId) (*CheckoutOrder, error) { + // Get cart state from cart service + cartGrain, err := s.Get(r.Context(), uint64(id)) + if err != nil { + return nil, err + } + + meta := GetCheckoutMetaFromRequest(r) + + payload, _, err := BuildCheckoutOrderPayload(cartGrain, meta) + if err != nil { + return nil, err + } + + grain, err := s.Get(r.Context(), uint64(id)) + if err != nil { + return nil, err + } + + if grain.OrderId != nil { + return s.klarnaClient.UpdateOrder(r.Context(), *grain.OrderId, bytes.NewReader(payload)) + } else { + return s.klarnaClient.CreateOrder(r.Context(), bytes.NewReader(payload)) + } +} + +func (s *CheckoutPoolServer) ApplyKlarnaPaymentStarted(ctx context.Context, klarnaOrder *CheckoutOrder, id checkout.CheckoutId) (*actor.MutationResult[*checkout.CheckoutGrain], error) { + method := "checkout" + return s.ApplyLocal(ctx, id, &messages.PaymentStarted{ + PaymentId: klarnaOrder.ID, + Amount: int64(klarnaOrder.OrderAmount), + Currency: klarnaOrder.PurchaseCurrency, + Provider: "klarna", + Method: &method, + StartedAt: timestamppb.New(time.Now()), + }) +} + +func (s *CheckoutPoolServer) CheckoutHandler(fn func(order *CheckoutOrder, w http.ResponseWriter) error) func(w http.ResponseWriter, r *http.Request) { + return CheckoutIdHandler(s.ProxyHandler(func(w http.ResponseWriter, r *http.Request, checkoutId checkout.CheckoutId) error { + orderId := r.URL.Query().Get("order_id") + if orderId == "" { + order, err := s.CreateOrUpdateCheckout(r, checkoutId) + if err != nil { + logger.Error("unable to create klarna session", "error", err) + return err + } + s.ApplyKlarnaPaymentStarted(r.Context(), order, checkoutId) + return fn(order, w) + } + order, err := s.klarnaClient.GetOrder(r.Context(), orderId) + if err != nil { + return err + } + return fn(order, w) + })) +} + +func (s *CheckoutPoolServer) getCartGrain(ctx context.Context, cartId cart.CartId, version int) (*cart.CartGrain, error) { + // Call cart service to get grain + url := fmt.Sprintf("%s/internal/cart/%s/%d", s.cartClient.baseUrl, cartId.String(), version) + req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + if err != nil { + return nil, err + } + resp, err := s.cartClient.httpClient.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("failed to get cart: %s", resp.Status) + } + var grain cart.CartGrain + err = json.NewDecoder(resp.Body).Decode(&grain) + return &grain, err +} + +func CheckoutIdHandler(fn func(checkoutId checkout.CheckoutId, w http.ResponseWriter, r *http.Request) error) func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + var id checkout.CheckoutId + raw := r.PathValue("id") + if raw == "" { + id = checkout.CheckoutId(cart.MustNewCartId()) + w.Header().Set("Set-Checkout-Id", id.String()) + } else { + if parsedId, ok := cart.ParseCartId(raw); !ok { + w.WriteHeader(http.StatusBadRequest) + w.Write([]byte("checkout id is invalid")) + return + } else { + id = checkout.CheckoutId(parsedId) + } + } + + err := fn(id, w, r) + if err != nil { + log.Printf("Server error, not remote error: %v\n", err) + w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte(err.Error())) + } + } +} + +func (s *CheckoutPoolServer) ProxyHandler(fn func(w http.ResponseWriter, r *http.Request, checkoutId checkout.CheckoutId) error) func(checkoutId checkout.CheckoutId, w http.ResponseWriter, r *http.Request) error { + return func(checkoutId checkout.CheckoutId, w http.ResponseWriter, r *http.Request) error { + if ownerHost, ok := s.OwnerHost(uint64(checkoutId)); ok { + ctx, span := tracer.Start(r.Context(), "proxy") + defer span.End() + span.SetAttributes(attribute.String("checkoutid", checkoutId.String())) + hostAttr := attribute.String("other host", ownerHost.Name()) + span.SetAttributes(hostAttr) + logger.InfoContext(ctx, "checkout proxyed", "result", ownerHost.Name()) + proxyCalls.Add(ctx, 1, metric.WithAttributes(hostAttr)) + handled, err := ownerHost.Proxy(uint64(checkoutId), w, r, nil) + + grainLookups.Inc() + if err == nil && handled { + return nil + } + } + _, span := tracer.Start(r.Context(), "own") + span.SetAttributes(attribute.String("checkoutid", checkoutId.String())) + defer span.End() + return fn(w, r, checkoutId) + } +} + +var ( + tracer = otel.Tracer(name) + hmacKey = os.Getenv("ADYEN_HMAC") + meter = otel.Meter(name) + logger = otelslog.NewLogger(name) + proxyCalls metric.Int64Counter +) + +func init() { + var err error + proxyCalls, err = meter.Int64Counter("proxy.calls", + metric.WithDescription("Number of proxy calls"), + metric.WithUnit("{calls}")) + if err != nil { + panic(err) + } +} + +func (s *CheckoutPoolServer) AdyenHookHandler(w http.ResponseWriter, r *http.Request) { + // Similar to cart's, but apply to checkout and then callback to cart +} + +func (s *CheckoutPoolServer) Serve(mux *http.ServeMux) { + handleFunc := func(pattern string, handlerFunc func(http.ResponseWriter, *http.Request)) { + attr := attribute.String("http.route", pattern) + mux.HandleFunc(pattern, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + span := trace.SpanFromContext(r.Context()) + span.SetName(pattern) + span.SetAttributes(attr) + + labeler, _ := otelhttp.LabelerFromContext(r.Context()) + labeler.Add(attr) + + handlerFunc(w, r) + })) + } + + handleFunc("/adyen_hook", s.AdyenHookHandler) + + handleFunc("GET /checkout", s.CheckoutHandler(func(order *CheckoutOrder, w http.ResponseWriter) error { + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.Header().Set("Permissions-Policy", "payment=(self \"https://js.stripe.com\" \"https://m.stripe.network\" \"https://js.playground.kustom.co\")") + w.WriteHeader(http.StatusOK) + _, err := fmt.Fprintf(w, tpl, order.HTMLSnippet) + return err + })) + + handleFunc("GET /confirmation/{order_id}", func(w http.ResponseWriter, r *http.Request) { + orderId := r.PathValue("order_id") + order, err := s.klarnaClient.GetOrder(r.Context(), orderId) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte(err.Error())) + return + } + + // Apply ConfirmationViewed to checkout + checkoutId := checkout.CheckoutId(cart.MustNewCartId()) // Need to resolve from order + s.Apply(r.Context(), uint64(checkoutId), &messages.ConfirmationViewed{}) + + // Callback to cart + cartId := cart.CartId(checkoutId) // Assuming same + s.cartClient.ApplyMutation(cartId, &messages.OrderCreated{OrderId: order.ID, Status: order.Status}) + + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.WriteHeader(http.StatusOK) + fmt.Fprintf(w, tpl, order.HTMLSnippet) + }) +} diff --git a/deployment/deployment.yaml b/deployment/deployment.yaml index 20eb1ae..be82eb9 100644 --- a/deployment/deployment.yaml +++ b/deployment/deployment.yaml @@ -357,6 +357,139 @@ spec: ports: - name: web port: 8080 + - name: internal + port: 8081 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: checkout-actor + arch: amd64 + name: checkout-actor-x86 +spec: + replicas: 3 + selector: + matchLabels: + app: checkout-actor + arch: amd64 + template: + metadata: + labels: + app: checkout-actor + actor-pool: checkout + arch: amd64 + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: NotIn + values: + - arm64 + volumes: + - name: data + nfs: + path: /i-data/7a8af061/nfs/checkout-actor + server: 10.10.1.10 + serviceAccountName: default + containers: + - image: registry.k6n.net/go-checkout-actor-amd64:latest + name: checkout-actor-amd64 + imagePullPolicy: Always + lifecycle: + preStop: + exec: + command: ["sleep", "15"] + ports: + - containerPort: 8080 + name: web + - containerPort: 8081 + name: debug + - containerPort: 1337 + name: rpc + livenessProbe: + httpGet: + path: /livez + port: web + failureThreshold: 1 + periodSeconds: 30 + readinessProbe: + httpGet: + path: /readyz + port: web + failureThreshold: 2 + initialDelaySeconds: 2 + periodSeconds: 50 + volumeMounts: + - mountPath: "/data" + name: data + resources: + limits: + memory: "768Mi" + requests: + memory: "70Mi" + cpu: "1200m" + env: + - name: TZ + value: "Europe/Stockholm" + - name: REDIS_ADDRESS + value: "10.10.3.18:6379" + - name: REDIS_PASSWORD + value: "slaskredis" + - name: OTEL_RESOURCE_ATTRIBUTES + value: "service.name=checkout,service.version=0.1.2" + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: "http://otel-debug-service.monitoring:4317" + - name: ADYEN_HMAC + valueFrom: + secretKeyRef: + name: adyen + key: HMAC + - name: ADYEN_API_KEY + valueFrom: + secretKeyRef: + name: adyen + key: API_KEY + - name: KLARNA_API_USERNAME + valueFrom: + secretKeyRef: + name: klarna-api-credentials + key: username + - name: KLARNA_API_PASSWORD + valueFrom: + secretKeyRef: + name: klarna-api-credentials + key: password + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: AMQP_URL + value: "amqp://admin:12bananer@rabbitmq.dev:5672/" + - name: CART_INTERNAL_URL + value: "http://cart-actor:8081" + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name +--- +kind: Service +apiVersion: v1 +metadata: + name: checkout-actor + annotations: + prometheus.io/port: "8081" + prometheus.io/scrape: "true" + prometheus.io/path: "/metrics" +spec: + selector: + app: checkout-actor + ports: + - name: web + port: 8080 --- kind: Service apiVersion: v1 diff --git a/pkg/actor/grpc_server.go b/pkg/actor/grpc_server.go index 5a2ad45..6a68d50 100644 --- a/pkg/actor/grpc_server.go +++ b/pkg/actor/grpc_server.go @@ -8,7 +8,7 @@ import ( "net" "time" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/control" "go.opentelemetry.io/contrib/bridges/otelslog" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" @@ -145,7 +145,7 @@ func (s *ControlServer[V]) AnnounceExpiry(ctx context.Context, req *messages.Exp } // ControlPlane: Ping -func (s *ControlServer[V]) Ping(ctx context.Context, _ *messages.Empty) (*messages.PingReply, error) { +func (s *ControlServer[V]) Ping(ctx context.Context, req *messages.Empty) (*messages.PingReply, error) { host := s.pool.Hostname() @@ -191,7 +191,7 @@ func (s *ControlServer[V]) Negotiate(ctx context.Context, req *messages.Negotiat } // ControlPlane: GetCartIds (locally owned carts only) -func (s *ControlServer[V]) GetLocalActorIds(ctx context.Context, _ *messages.Empty) (*messages.ActorIdsReply, error) { +func (s *ControlServer[V]) GetLocalActorIds(ctx context.Context, req *messages.Empty) (*messages.ActorIdsReply, error) { ctx, span := tracer.Start(ctx, "grpc_get_local_actor_ids") defer span.End() ids := s.pool.GetLocalIds() diff --git a/pkg/actor/grpc_server_test.go b/pkg/actor/grpc_server_test.go index cf83f83..75318c8 100644 --- a/pkg/actor/grpc_server_test.go +++ b/pkg/actor/grpc_server_test.go @@ -4,7 +4,8 @@ import ( "context" "testing" - "git.k6n.net/go-cart-actor/pkg/messages" + cart_messages "git.k6n.net/go-cart-actor/proto/cart" + control_plane_messages "git.k6n.net/go-cart-actor/proto/control" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/protobuf/proto" @@ -70,12 +71,12 @@ func TestApplyRequestWithMutations(t *testing.T) { } defer conn.Close() - client := messages.NewControlPlaneClient(conn) + client := control_plane_messages.NewControlPlaneClient(conn) // Prepare ApplyRequest with multiple Any messages - addItemAny, _ := anypb.New(&messages.AddItem{ItemId: 1, Quantity: 2}) - removeItemAny, _ := anypb.New(&messages.RemoveItem{Id: 1}) - req := &messages.ApplyRequest{ + addItemAny, _ := anypb.New(&cart_messages.AddItem{ItemId: 1, Quantity: 2}) + removeItemAny, _ := anypb.New(&cart_messages.RemoveItem{Id: 1}) + req := &control_plane_messages.ApplyRequest{ Id: 123, Messages: []*anypb.Any{addItemAny, removeItemAny}, } @@ -95,10 +96,10 @@ func TestApplyRequestWithMutations(t *testing.T) { if len(pool.applied) != 2 { t.Errorf("expected 2 mutations applied, got %d", len(pool.applied)) } - if addItem, ok := pool.applied[0].(*messages.AddItem); !ok || addItem.ItemId != 1 { + if addItem, ok := pool.applied[0].(*cart_messages.AddItem); !ok || addItem.ItemId != 1 { t.Errorf("expected AddItem with ItemId=1, got %v", pool.applied[0]) } - if removeItem, ok := pool.applied[1].(*messages.RemoveItem); !ok || removeItem.Id != 1 { + if removeItem, ok := pool.applied[1].(*cart_messages.RemoveItem); !ok || removeItem.Id != 1 { t.Errorf("expected RemoveItem with Id=1, got %v", pool.applied[1]) } } diff --git a/pkg/actor/mutation_registry_test.go b/pkg/actor/mutation_registry_test.go index 911b86a..419b29c 100644 --- a/pkg/actor/mutation_registry_test.go +++ b/pkg/actor/mutation_registry_test.go @@ -57,7 +57,7 @@ func TestRegisteredMutationBasics(t *testing.T) { } // GetTypeName should fail for unregistered type - if name, ok := reg.GetTypeName(&messages.Noop{}); ok || name != "" { + if name, ok := reg.GetTypeName(&messages.RemoveItem{}); ok || name != "" { t.Fatalf("expected GetTypeName to fail for unregistered message, got (%q,%v)", name, ok) } @@ -99,7 +99,7 @@ func TestRegisteredMutationBasics(t *testing.T) { } // Apply unregistered message - _, err := reg.Apply(context.Background(), state, &messages.Noop{}) + _, err := reg.Apply(context.Background(), state, &messages.RemoveItem{}) if err != ErrMutationNotRegistered { t.Fatalf("expected ErrMutationNotRegistered, got %v", err) } diff --git a/pkg/cart/cart-grain.go b/pkg/cart/cart-grain.go index 7891b01..2a3cb80 100644 --- a/pkg/cart/cart-grain.go +++ b/pkg/cart/cart-grain.go @@ -2,11 +2,9 @@ package cart import ( "encoding/json" - "slices" "sync" "time" - messages "git.k6n.net/go-cart-actor/pkg/messages" "git.k6n.net/go-cart-actor/pkg/voucher" "github.com/matst80/go-redis-inventory/pkg/inventory" ) @@ -55,14 +53,6 @@ type CartItem struct { ReservationEndTime *time.Time `json:"reservationEndTime,omitempty"` } -type CartDelivery struct { - Id uint32 `json:"id"` - Provider string `json:"provider"` - Price Price `json:"price"` - Items []uint32 `json:"items"` - PickupPoint *messages.PickupPoint `json:"pickupPoint,omitempty"` -} - type CartNotification struct { LinkedId int `json:"id"` Provider string `json:"provider"` @@ -84,103 +74,46 @@ type Notice struct { Code *string `json:"code,omitempty"` } -type PaymentStatus string -type CartPaymentStatus PaymentStatus +type CartPaymentStatus string const ( - PaymentStatusPending PaymentStatus = "pending" - PaymentStatusFailed PaymentStatus = "failed" - PaymentStatusSuccess PaymentStatus = "success" CartPaymentStatusPending CartPaymentStatus = "pending" CartPaymentStatusFailed CartPaymentStatus = "failed" CartPaymentStatusSuccess CartPaymentStatus = "success" CartPaymentStatusCancelled CartPaymentStatus = "partial" ) -type CartPayment struct { - PaymentId string `json:"paymentId"` - Status PaymentStatus `json:"status"` - Amount int64 `json:"amount"` - Currency string `json:"currency"` - Provider string `json:"provider,omitempty"` - Method *string `json:"method,omitempty"` - Events []*PaymentEvent `json:"events,omitempty"` - ProcessorReference *string `json:"processorReference,omitempty"` - StartedAt *time.Time `json:"startedAt,omitempty"` - CompletedAt *time.Time `json:"completedAt,omitempty"` -} - -type PaymentEvent struct { - Name string `json:"name"` - Success bool `json:"success"` - Data json.RawMessage `json:"data"` -} - -func (p *CartPayment) IsSettled() bool { - if p == nil { - return false - } - - switch p.Status { - case PaymentStatusSuccess: - return true - default: - return false - } -} - type Marking struct { Type uint32 `json:"type"` Text string `json:"text"` } -type GiftcardItem struct { - Id uint32 `json:"id"` - Value Price `json:"value"` - DeliveryDate string `json:"deliveryDate"` - Recipient string `json:"recipient"` - RecipientType string `json:"recipientType"` - Message string `json:"message"` - DesignConfig json.RawMessage `json:"designConfig,omitempty"` -} - type CartGrain struct { - mu sync.RWMutex - lastItemId uint32 - lastDeliveryId uint32 - lastVoucherId uint32 - lastGiftcardId uint32 - lastAccess time.Time - lastChange time.Time // unix seconds of last successful mutation (replay sets from event ts) - userId string - Version uint `json:"version"` - InventoryReserved bool `json:"inventoryReserved"` - Id CartId `json:"id"` - Items []*CartItem `json:"items"` - Giftcards []*GiftcardItem `json:"giftcards,omitempty"` - TotalPrice *Price `json:"totalPrice"` - TotalDiscount *Price `json:"totalDiscount"` - Deliveries []*CartDelivery `json:"deliveries,omitempty"` - Processing bool `json:"processing"` - PaymentInProgress uint16 `json:"paymentInProgress"` - OrderReference string `json:"orderReference,omitempty"` - PaymentStatus PaymentStatus `json:"paymentStatus,omitempty"` - PaidInFull bool `json:"paidInFull"` - Vouchers []*Voucher `json:"vouchers,omitempty"` - Notifications []CartNotification `json:"cartNotification,omitempty"` - SubscriptionDetails map[string]*SubscriptionDetails `json:"subscriptionDetails,omitempty"` - PaymentDeclinedNotices []Notice `json:"paymentDeclinedNotices,omitempty"` - Payments []*CartPayment `json:"payments,omitempty"` - Confirmation *ConfirmationStatus `json:"confirmation,omitempty"` - //CheckoutOrderId string `json:"checkoutOrderId,omitempty"` - CheckoutStatus CartPaymentStatus `json:"checkoutStatus,omitempty"` - //CheckoutCountry string `json:"checkoutCountry,omitempty"` -} + mu sync.RWMutex + lastItemId uint32 + lastVoucherId uint32 + lastAccess time.Time + lastChange time.Time // unix seconds of last successful mutation (replay sets from event ts) + userId string + Currency string `json:"currency"` + Language string `json:"language"` + Version uint `json:"version"` + InventoryReserved bool `json:"inventoryReserved"` + Id CartId `json:"id"` + Items []*CartItem `json:"items"` + TotalPrice *Price `json:"totalPrice"` + TotalDiscount *Price `json:"totalDiscount"` + Processing bool `json:"processing"` + //PaymentInProgress uint16 `json:"paymentInProgress"` + OrderReference string `json:"orderReference,omitempty"` -type ConfirmationStatus struct { - Code *string `json:"code,omitempty"` - ViewCount int `json:"viewCount"` - LastViewedAt time.Time `json:"lastViewedAt"` + Vouchers []*Voucher `json:"vouchers,omitempty"` + Notifications []CartNotification `json:"cartNotification,omitempty"` + SubscriptionDetails map[string]*SubscriptionDetails `json:"subscriptionDetails,omitempty"` + + //CheckoutOrderId string `json:"checkoutOrderId,omitempty"` + CheckoutStatus *CartPaymentStatus `json:"checkoutStatus,omitempty"` + //CheckoutCountry string `json:"checkoutCountry,omitempty"` } type Voucher struct { @@ -243,19 +176,14 @@ func (v *Voucher) AppliesTo(cart *CartGrain) ([]*CartItem, bool) { func NewCartGrain(id uint64, ts time.Time) *CartGrain { return &CartGrain{ lastItemId: 0, - lastDeliveryId: 0, lastVoucherId: 0, - lastGiftcardId: 0, lastAccess: ts, lastChange: ts, TotalDiscount: NewPrice(), Vouchers: []*Voucher{}, - Deliveries: []*CartDelivery{}, - Giftcards: []*GiftcardItem{}, Id: CartId(id), Items: []*CartItem{}, TotalPrice: NewPrice(), - Payments: []*CartPayment{}, SubscriptionDetails: make(map[string]*SubscriptionDetails), } } @@ -294,33 +222,6 @@ func (c *CartGrain) GetState() ([]byte, error) { return json.Marshal(c) } -func (c *CartGrain) ItemsWithDelivery() []uint32 { - ret := make([]uint32, 0, len(c.Items)) - for _, item := range c.Items { - for _, delivery := range c.Deliveries { - for _, id := range delivery.Items { - if item.Id == id { - ret = append(ret, id) - } - } - } - } - return ret -} - -func (c *CartGrain) ItemsWithoutDelivery() []uint32 { - ret := make([]uint32, 0, len(c.Items)) - hasDelivery := c.ItemsWithDelivery() - for _, item := range c.Items { - found := slices.Contains(hasDelivery, item.Id) - - if !found { - ret = append(ret, item.Id) - } - } - return ret -} - func (c *CartGrain) FindItemWithSku(sku string) (*CartItem, bool) { c.mu.RLock() defer c.mu.RUnlock() @@ -332,73 +233,6 @@ func (c *CartGrain) FindItemWithSku(sku string) (*CartItem, bool) { return nil, false } -func (c *CartGrain) FindPayment(paymentId string) (*CartPayment, bool) { - if paymentId == "" { - return nil, false - } - for _, payment := range c.Payments { - if payment != nil && payment.PaymentId == paymentId { - return payment, true - } - } - return nil, false -} - -func (c *CartGrain) SettledPayments() []*CartPayment { - if len(c.Payments) == 0 { - return nil - } - settled := make([]*CartPayment, 0, len(c.Payments)) - for _, payment := range c.Payments { - if payment != nil && payment.IsSettled() { - settled = append(settled, payment) - } - } - if len(settled) == 0 { - return nil - } - return settled -} - -func (c *CartGrain) OpenPayments() []*CartPayment { - if len(c.Payments) == 0 { - return nil - } - pending := make([]*CartPayment, 0, len(c.Payments)) - for _, payment := range c.Payments { - if payment == nil { - continue - } - if !payment.IsSettled() { - pending = append(pending, payment) - } - } - if len(pending) == 0 { - return nil - } - return pending -} - -// func (c *CartGrain) Apply(content proto.Message, isReplay bool) (*CartGrain, error) { - -// updated, err := ApplyRegistered(c, content) -// if err != nil { -// if err == ErrMutationNotRegistered { -// return nil, fmt.Errorf("unsupported mutation type %T (not registered)", content) -// } -// return nil, err -// } - -// // Sliding TTL: update lastChange only for non-replay successful mutations. -// if updated != nil && !isReplay { -// c.lastChange = time.Now() -// c.lastAccess = time.Now() -// go AppendCartEvent(c.Id, content) -// } - -// return updated, nil -// } - func (c *CartGrain) UpdateTotals() { c.TotalPrice = NewPrice() c.TotalDiscount = NewPrice() @@ -423,12 +257,7 @@ func (c *CartGrain) UpdateTotals() { c.TotalPrice.Add(*rowTotal) } - for _, delivery := range c.Deliveries { - c.TotalPrice.Add(delivery.Price) - } - for _, giftcard := range c.Giftcards { - c.TotalPrice.Add(giftcard.Value) - } + for _, voucher := range c.Vouchers { _, ok := voucher.AppliesTo(c) voucher.Applied = false diff --git a/pkg/cart/cart-mutation-helper.go b/pkg/cart/cart-mutation-helper.go index 74d0665..ecdc397 100644 --- a/pkg/cart/cart-mutation-helper.go +++ b/pkg/cart/cart-mutation-helper.go @@ -5,7 +5,7 @@ import ( "time" "git.k6n.net/go-cart-actor/pkg/actor" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" "github.com/matst80/go-redis-inventory/pkg/inventory" ) @@ -70,21 +70,6 @@ func NewCartMultationRegistry(context *CartMutationContext) actor.MutationRegist actor.NewMutation(context.RemoveItem, func() *messages.RemoveItem { return &messages.RemoveItem{} }), - actor.NewMutation(context.InitializeCheckout, func() *messages.InitializeCheckout { - return &messages.InitializeCheckout{} - }), - actor.NewMutation(OrderCreated, func() *messages.OrderCreated { - return &messages.OrderCreated{} - }), - actor.NewMutation(RemoveDelivery, func() *messages.RemoveDelivery { - return &messages.RemoveDelivery{} - }), - actor.NewMutation(SetDelivery, func() *messages.SetDelivery { - return &messages.SetDelivery{} - }), - actor.NewMutation(SetPickupPoint, func() *messages.SetPickupPoint { - return &messages.SetPickupPoint{} - }), actor.NewMutation(ClearCart, func() *messages.ClearCartRequest { return &messages.ClearCartRequest{} }), @@ -97,12 +82,6 @@ func NewCartMultationRegistry(context *CartMutationContext) actor.MutationRegist actor.NewMutation(UpsertSubscriptionDetails, func() *messages.UpsertSubscriptionDetails { return &messages.UpsertSubscriptionDetails{} }), - actor.NewMutation(context.InventoryReserved, func() *messages.InventoryReserved { - return &messages.InventoryReserved{} - }), - actor.NewMutation(PreConditionFailed, func() *messages.PreConditionFailed { - return &messages.PreConditionFailed{} - }), actor.NewMutation(SetUserId, func() *messages.SetUserId { return &messages.SetUserId{} }), @@ -115,30 +94,6 @@ func NewCartMultationRegistry(context *CartMutationContext) actor.MutationRegist actor.NewMutation(SubscriptionAdded, func() *messages.SubscriptionAdded { return &messages.SubscriptionAdded{} }), - actor.NewMutation(PaymentStarted, func() *messages.PaymentStarted { - return &messages.PaymentStarted{} - }), - actor.NewMutation(PaymentCompleted, func() *messages.PaymentCompleted { - return &messages.PaymentCompleted{} - }), - actor.NewMutation(PaymentDeclined, func() *messages.PaymentDeclined { - return &messages.PaymentDeclined{} - }), - actor.NewMutation(PaymentEventHandler, func() *messages.PaymentEvent { - return &messages.PaymentEvent{} - }), - actor.NewMutation(ConfirmationViewed, func() *messages.ConfirmationViewed { - return &messages.ConfirmationViewed{} - }), - actor.NewMutation(CreateCheckoutOrder, func() *messages.CreateCheckoutOrder { - return &messages.CreateCheckoutOrder{} - }), - actor.NewMutation(AddGiftcard, func() *messages.AddGiftcard { - return &messages.AddGiftcard{} - }), - actor.NewMutation(RemoveGiftcard, func() *messages.RemoveGiftcard { - return &messages.RemoveGiftcard{} - }), ) return reg diff --git a/pkg/cart/cart_grain_totals_test.go b/pkg/cart/cart_grain_totals_test.go deleted file mode 100644 index b05b069..0000000 --- a/pkg/cart/cart_grain_totals_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package cart - -import ( - "testing" -) - -// helper to create a cart grain with items and deliveries -func newTestCart() *CartGrain { - return &CartGrain{Items: []*CartItem{}, Deliveries: []*CartDelivery{}, Vouchers: []*Voucher{}, Notifications: []CartNotification{}} -} - -func TestCartGrainUpdateTotalsBasic(t *testing.T) { - c := newTestCart() - // Item1 price 1250 (ex 1000 vat 250) org price higher -> discount 200 per unit - item1Price := Price{IncVat: 1250, VatRates: map[float32]int64{25: 250}} - item1Org := &Price{IncVat: 1500, VatRates: map[float32]int64{25: 300}} - item2Price := Price{IncVat: 2000, VatRates: map[float32]int64{25: 400}} - c.Items = []*CartItem{ - {Id: 1, Price: item1Price, OrgPrice: item1Org, Quantity: 2}, - {Id: 2, Price: item2Price, OrgPrice: &item2Price, Quantity: 1}, - } - deliveryPrice := Price{IncVat: 4900, VatRates: map[float32]int64{25: 980}} - c.Deliveries = []*CartDelivery{{Id: 1, Price: deliveryPrice, Items: []uint32{1, 2}}} - - c.UpdateTotals() - - // Expected totals: sum inc vat of items * qty plus delivery - // item1 total inc = 1250*2 = 2500 - // item2 total inc = 2000*1 = 2000 - // delivery inc = 4900 - expectedInc := int64(2500 + 2000 + 4900) - if c.TotalPrice.IncVat != expectedInc { - t.Fatalf("TotalPrice IncVat expected %d got %d", expectedInc, c.TotalPrice.IncVat) - } - - // Discount: current implementation computes (OrgPrice - Price) ignoring quantity -> 1500-1250=250 - if c.TotalDiscount.IncVat != 500 { - t.Fatalf("TotalDiscount expected 500 got %d", c.TotalDiscount.IncVat) - } -} - -func TestCartGrainUpdateTotalsNoItems(t *testing.T) { - c := newTestCart() - c.UpdateTotals() - if c.TotalPrice.IncVat != 0 || c.TotalDiscount.IncVat != 0 { - t.Fatalf("expected zero totals got %+v", c) - } -} diff --git a/pkg/cart/mutation_add_giftcard.go b/pkg/cart/mutation_add_giftcard.go deleted file mode 100644 index 5ef9dd7..0000000 --- a/pkg/cart/mutation_add_giftcard.go +++ /dev/null @@ -1,44 +0,0 @@ -package cart - -import ( - "encoding/json" - "fmt" - - messages "git.k6n.net/go-cart-actor/pkg/messages" - "google.golang.org/protobuf/proto" -) - -func AddGiftcard(grain *CartGrain, req *messages.AddGiftcard) error { - if req.Giftcard == nil { - return fmt.Errorf("giftcard cannot be nil") - } - if req.Giftcard.Value <= 0 { - return fmt.Errorf("giftcard value must be positive") - } - if grain.PaymentInProgress > 0 { - return ErrPaymentInProgress - } - grain.lastGiftcardId++ - designConfig := json.RawMessage{} - if req.Giftcard.DesignConfig != nil { - // Convert Any to RawMessage - data, err := proto.Marshal(req.Giftcard.DesignConfig) - if err != nil { - return fmt.Errorf("failed to marshal designConfig: %w", err) - } - designConfig = data - } - value := NewPriceFromIncVat(req.Giftcard.Value, 25) // Assuming 25% tax; adjust as needed - item := &GiftcardItem{ - Id: grain.lastGiftcardId, - Value: *value, - DeliveryDate: req.Giftcard.DeliveryDate, - Recipient: req.Giftcard.Recipient, - RecipientType: req.Giftcard.RecipientType, - Message: req.Giftcard.Message, - DesignConfig: designConfig, - } - grain.Giftcards = append(grain.Giftcards, item) - grain.UpdateTotals() - return nil -} diff --git a/pkg/cart/mutation_add_item.go b/pkg/cart/mutation_add_item.go index c4b9a47..655942a 100644 --- a/pkg/cart/mutation_add_item.go +++ b/pkg/cart/mutation_add_item.go @@ -7,7 +7,7 @@ import ( "log" "time" - messages "git.k6n.net/go-cart-actor/pkg/messages" + cart_messages "git.k6n.net/go-cart-actor/proto/cart" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -26,7 +26,7 @@ import ( // must keep this handler in sync. var ErrPaymentInProgress = errors.New("payment in progress") -func (c *CartMutationContext) AddItem(g *CartGrain, m *messages.AddItem) error { +func (c *CartMutationContext) AddItem(g *CartGrain, m *cart_messages.AddItem) error { ctx := context.Background() if m == nil { return fmt.Errorf("AddItem: nil payload") @@ -34,9 +34,6 @@ func (c *CartMutationContext) AddItem(g *CartGrain, m *messages.AddItem) error { if m.Quantity < 1 { return fmt.Errorf("AddItem: invalid quantity %d", m.Quantity) } - if g.PaymentInProgress > 0 { - return ErrPaymentInProgress - } // Merge with any existing item having same SKU and matching StoreId (including both nil). for _, existing := range g.Items { diff --git a/pkg/cart/mutation_add_voucher.go b/pkg/cart/mutation_add_voucher.go index 41a2dfd..2f86772 100644 --- a/pkg/cart/mutation_add_voucher.go +++ b/pkg/cart/mutation_add_voucher.go @@ -4,7 +4,7 @@ import ( "slices" "git.k6n.net/go-cart-actor/pkg/actor" - "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" ) func RemoveVoucher(g *CartGrain, m *messages.RemoveVoucher) error { @@ -15,7 +15,7 @@ func RemoveVoucher(g *CartGrain, m *messages.RemoveVoucher) error { StatusCode: 400, } } - if g.PaymentInProgress > 0 { + if g.CheckoutStatus != nil { return ErrPaymentInProgress } @@ -45,10 +45,6 @@ func AddVoucher(g *CartGrain, m *messages.AddVoucher) error { } } - if g.PaymentInProgress > 0 { - return ErrPaymentInProgress - } - if slices.ContainsFunc(g.Vouchers, func(v *Voucher) bool { return v.Code == m.Code }) { diff --git a/pkg/cart/mutation_change_quantity.go b/pkg/cart/mutation_change_quantity.go index 3dde678..f0ea9c2 100644 --- a/pkg/cart/mutation_change_quantity.go +++ b/pkg/cart/mutation_change_quantity.go @@ -5,7 +5,7 @@ import ( "fmt" "log" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" ) // mutation_change_quantity.go @@ -32,9 +32,7 @@ func (c *CartMutationContext) ChangeQuantity(g *CartGrain, m *messages.ChangeQua if m == nil { return fmt.Errorf("ChangeQuantity: nil payload") } - if g.PaymentInProgress > 0 { - return ErrPaymentInProgress - } + ctx := context.Background() foundIndex := -1 diff --git a/pkg/cart/mutation_clear_cart.go b/pkg/cart/mutation_clear_cart.go new file mode 100644 index 0000000..40d4f27 --- /dev/null +++ b/pkg/cart/mutation_clear_cart.go @@ -0,0 +1,26 @@ +package cart + +import ( + "fmt" + + messages "git.k6n.net/go-cart-actor/proto/cart" +) + +func ClearCart(g *CartGrain, m *messages.ClearCartRequest) error { + if m == nil { + return fmt.Errorf("ClearCart: nil payload") + } + if g.CheckoutStatus != nil { + return fmt.Errorf("ClearCart: cart is in checkout") + } + // Clear items, vouchers, etc., but keep userId, etc. + g.Items = g.Items[:0] + g.Vouchers = g.Vouchers[:0] + g.Notifications = g.Notifications[:0] + g.OrderReference = "" + g.Processing = false + + // g.InventoryReserved = false maybe should release inventory + g.UpdateTotals() + return nil +} diff --git a/pkg/cart/mutation_confirmation_viewed.go b/pkg/cart/mutation_confirmation_viewed.go deleted file mode 100644 index a6dc2a4..0000000 --- a/pkg/cart/mutation_confirmation_viewed.go +++ /dev/null @@ -1,21 +0,0 @@ -package cart - -import ( - "time" - - messages "git.k6n.net/go-cart-actor/pkg/messages" -) - -func ConfirmationViewed(grain *CartGrain, req *messages.ConfirmationViewed) error { - if grain.Confirmation == nil { - grain.Confirmation = &ConfirmationStatus{ - ViewCount: 1, - LastViewedAt: time.Now(), - } - } else { - grain.Confirmation.ViewCount++ - grain.Confirmation.LastViewedAt = time.Now() - } - - return nil -} diff --git a/pkg/cart/mutation_create_checkout_order.go b/pkg/cart/mutation_create_checkout_order.go deleted file mode 100644 index e4ea3b2..0000000 --- a/pkg/cart/mutation_create_checkout_order.go +++ /dev/null @@ -1,21 +0,0 @@ -package cart - -import ( - "errors" - - messages "git.k6n.net/go-cart-actor/pkg/messages" -) - -func CreateCheckoutOrder(grain *CartGrain, req *messages.CreateCheckoutOrder) error { - if len(grain.Items) == 0 { - return errors.New("cannot checkout empty cart") - } - if req.Terms != "accepted" { - return errors.New("terms must be accepted") - } - // Validate other fields as needed - //grain.CheckoutOrderId = uuid.New().String() - grain.CheckoutStatus = "pending" - //grain.CheckoutCountry = req.Country - return nil -} diff --git a/pkg/cart/mutation_initialize_checkout.go b/pkg/cart/mutation_initialize_checkout.go deleted file mode 100644 index 915ede2..0000000 --- a/pkg/cart/mutation_initialize_checkout.go +++ /dev/null @@ -1,59 +0,0 @@ -package cart - -import ( - "context" - "fmt" - "time" - - messages "git.k6n.net/go-cart-actor/pkg/messages" -) - -// mutation_initialize_checkout.go -// -// Registers the InitializeCheckout mutation. -// This mutation is invoked AFTER an external Klarna checkout session -// has been successfully created or updated. It persists the Klarna -// order reference / status and marks the cart as having a payment in progress. -// -// Behavior: -// - Sets OrderReference to the Klarna order ID (overwriting if already set). -// - Sets PaymentStatus to the current Klarna status. -// - Sets / updates PaymentInProgress flag. -// - Does NOT alter pricing or line items (so no totals recalculation). -// -// Validation: -// - Returns an error if payload is nil. -// - Returns an error if orderId is empty (integrity guard). -// -// Concurrency: -// - Relies on upstream mutation serialization for a single grain. If -// parallel checkout attempts are possible, add higher-level guards -// (e.g. reject if PaymentInProgress already true unless reusing -// the same OrderReference). - -func (c *CartMutationContext) InitializeCheckout(g *CartGrain, m *messages.InitializeCheckout) error { - if m == nil { - return fmt.Errorf("InitializeCheckout: nil payload") - } - if m.OrderId == "" { - return fmt.Errorf("InitializeCheckout: missing orderId") - } - ctx := context.Background() - now := time.Now() - for _, item := range g.Items { - if item.ReservationEndTime != nil { - if now.After(*item.ReservationEndTime) { - endTime, err := c.ReserveItem(ctx, g.Id, item.Sku, item.StoreId, item.Quantity) - if err != nil { - return err - } - item.ReservationEndTime = endTime - } - } - } - - g.OrderReference = m.OrderId - //g.PaymentStatus = m.Status - //g.PaymentInProgress = m.PaymentInProgress - return nil -} diff --git a/pkg/cart/mutation_inventory_reserved.go b/pkg/cart/mutation_inventory_reserved.go deleted file mode 100644 index bd9fff6..0000000 --- a/pkg/cart/mutation_inventory_reserved.go +++ /dev/null @@ -1,22 +0,0 @@ -package cart - -import ( - "context" - "log" - "time" - - "git.k6n.net/go-cart-actor/pkg/messages" -) - -func (c *CartMutationContext) InventoryReserved(g *CartGrain, m *messages.InventoryReserved) error { - for _, item := range g.Items { - if item.ReservationEndTime != nil && item.ReservationEndTime.After(time.Now()) { - err := c.ReleaseItem(context.Background(), g.Id, item.Sku, item.StoreId) - if err != nil { - log.Printf("unable to release item reservation") - } - } - } - g.InventoryReserved = true - return nil -} diff --git a/pkg/cart/mutation_line_item_marking.go b/pkg/cart/mutation_line_item_marking.go index 841b395..18b91f0 100644 --- a/pkg/cart/mutation_line_item_marking.go +++ b/pkg/cart/mutation_line_item_marking.go @@ -3,7 +3,7 @@ package cart import ( "fmt" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" ) func LineItemMarking(grain *CartGrain, req *messages.LineItemMarking) error { diff --git a/pkg/cart/mutation_payment_completed.go b/pkg/cart/mutation_payment_completed.go deleted file mode 100644 index f1db426..0000000 --- a/pkg/cart/mutation_payment_completed.go +++ /dev/null @@ -1,33 +0,0 @@ -package cart - -import ( - "fmt" - "time" - - messages "git.k6n.net/go-cart-actor/pkg/messages" -) - -// PaymentStarted registers the beginning of a payment attempt for a cart. -// It either upserts the payment entry (based on paymentId) or creates a new one, -// marks the cart as having an in-progress payment, and recalculates the PaidInFull flag. -func PaymentCompleted(grain *CartGrain, msg *messages.PaymentCompleted) error { - if msg == nil { - return fmt.Errorf("PaymentStarted: nil payload") - } - paymentId := msg.PaymentId - payment, found := grain.FindPayment(paymentId) - if !found { - return fmt.Errorf("PaymentStarted: payment not found") - } - - payment.ProcessorReference = msg.ProcessorReference - payment.Status = PaymentStatusSuccess - payment.Amount = msg.Amount - payment.Currency = msg.Currency - payment.CompletedAt = asPointer(time.Now()) - - // maybe update cart status - grain.PaymentInProgress-- - - return nil -} diff --git a/pkg/cart/mutation_payment_declined.go b/pkg/cart/mutation_payment_declined.go deleted file mode 100644 index c206f9b..0000000 --- a/pkg/cart/mutation_payment_declined.go +++ /dev/null @@ -1,27 +0,0 @@ -package cart - -import ( - "errors" - "time" - - messages "git.k6n.net/go-cart-actor/pkg/messages" -) - -func asPointer[T any](value T) *T { - return &value -} - -var ErrPaymentNotFound = errors.New("payment not found") - -func PaymentDeclined(grain *CartGrain, req *messages.PaymentDeclined) error { - - payment, found := grain.FindPayment(req.PaymentId) - if !found { - return ErrPaymentNotFound - } - - payment.CompletedAt = asPointer(time.Now()) - payment.Status = PaymentStatusFailed - grain.PaymentInProgress-- - return nil -} diff --git a/pkg/cart/mutation_payment_event.go b/pkg/cart/mutation_payment_event.go deleted file mode 100644 index d4b9db6..0000000 --- a/pkg/cart/mutation_payment_event.go +++ /dev/null @@ -1,22 +0,0 @@ -package cart - -import ( - "encoding/json" - - messages "git.k6n.net/go-cart-actor/pkg/messages" -) - -func PaymentEventHandler(grain *CartGrain, req *messages.PaymentEvent) error { - - payment, found := grain.FindPayment(req.PaymentId) - if !found { - return ErrPaymentNotFound - } - metaBytes := req.Data.GetValue() - payment.Events = append(payment.Events, &PaymentEvent{ - Name: req.Name, - Success: req.Success, - Data: json.RawMessage(metaBytes), - }) - return nil -} diff --git a/pkg/cart/mutation_precondition.go b/pkg/cart/mutation_precondition.go deleted file mode 100644 index b008c69..0000000 --- a/pkg/cart/mutation_precondition.go +++ /dev/null @@ -1,7 +0,0 @@ -package cart - -import messages "git.k6n.net/go-cart-actor/pkg/messages" - -func PreConditionFailed(g *CartGrain, m *messages.PreConditionFailed) error { - return nil -} diff --git a/pkg/cart/mutation_remove_giftcard.go b/pkg/cart/mutation_remove_giftcard.go deleted file mode 100644 index 3bcce09..0000000 --- a/pkg/cart/mutation_remove_giftcard.go +++ /dev/null @@ -1,21 +0,0 @@ -package cart - -import ( - "fmt" - - messages "git.k6n.net/go-cart-actor/pkg/messages" -) - -func RemoveGiftcard(grain *CartGrain, req *messages.RemoveGiftcard) error { - if grain.PaymentInProgress > 0 { - return ErrPaymentInProgress - } - for i, item := range grain.Giftcards { - if item.Id == req.Id { - grain.Giftcards = append(grain.Giftcards[:i], grain.Giftcards[i+1:]...) - grain.UpdateTotals() - return nil - } - } - return fmt.Errorf("giftcard with ID %d not found", req.Id) -} diff --git a/pkg/cart/mutation_remove_item.go b/pkg/cart/mutation_remove_item.go index 6011c61..dbd6eb4 100644 --- a/pkg/cart/mutation_remove_item.go +++ b/pkg/cart/mutation_remove_item.go @@ -6,7 +6,7 @@ import ( "log" "time" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" ) // mutation_remove_item.go @@ -29,9 +29,7 @@ func (c *CartMutationContext) RemoveItem(g *CartGrain, m *messages.RemoveItem) e if m == nil { return fmt.Errorf("RemoveItem: nil payload") } - if g.PaymentInProgress > 0 { - return ErrPaymentInProgress - } + targetID := uint32(m.Id) index := -1 diff --git a/pkg/cart/mutation_remove_line_item_marking.go b/pkg/cart/mutation_remove_line_item_marking.go index 7ce0f41..6cc1db2 100644 --- a/pkg/cart/mutation_remove_line_item_marking.go +++ b/pkg/cart/mutation_remove_line_item_marking.go @@ -3,7 +3,7 @@ package cart import ( "fmt" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" ) func RemoveLineItemMarking(grain *CartGrain, req *messages.RemoveLineItemMarking) error { diff --git a/pkg/cart/mutation_set_delivery.go b/pkg/cart/mutation_set_delivery.go deleted file mode 100644 index 8a9d916..0000000 --- a/pkg/cart/mutation_set_delivery.go +++ /dev/null @@ -1,99 +0,0 @@ -package cart - -import ( - "fmt" - "slices" - - messages "git.k6n.net/go-cart-actor/pkg/messages" -) - -// mutation_set_delivery.go -// -// Registers the SetDelivery mutation. -// -// Semantics (mirrors legacy switch logic): -// - If the payload specifies an explicit list of item IDs (payload.Items): -// - Each referenced cart line must exist. -// - None of the referenced items may already belong to a delivery. -// - Only those items are associated with the new delivery. -// - If payload.Items is empty: -// - All items currently without any delivery are associated with the new delivery. -// - A new delivery line is created with: -// - Auto-incremented delivery ID (cart-local) -// - Provider from payload -// - Fixed price (currently hard-coded: 4900 minor units) – adjust as needed -// - Optional PickupPoint copied from payload -// - Cart totals are recalculated (WithTotals) -// -// Error cases: -// - Referenced item does not exist -// - Referenced item already has a delivery -// - No items qualify (resulting association set empty) -> returns error (prevents creating empty delivery) -// -// Concurrency: -// - Uses g.mu to protect lastDeliveryId increment and append to Deliveries slice. -// Item scans are read-only and performed outside the lock for simplicity; -// if stricter guarantees are needed, widen the lock section. -// -// Future extension points: -// - Variable delivery pricing (based on weight, distance, provider, etc.) -// - Validation of provider codes -// - Multi-currency delivery pricing - -func SetDelivery(g *CartGrain, m *messages.SetDelivery) error { - if m == nil { - return fmt.Errorf("SetDelivery: nil payload") - } - if m.Provider == "" { - return fmt.Errorf("SetDelivery: provider is empty") - } - if g.PaymentInProgress > 0 { - return ErrPaymentInProgress - } - - withDelivery := g.ItemsWithDelivery() - targetItems := make([]uint32, 0) - - if len(m.Items) == 0 { - // Use every item currently without a delivery - targetItems = append(targetItems, g.ItemsWithoutDelivery()...) - } else { - // Validate explicit list - for _, id64 := range m.Items { - id := uint32(id64) - found := false - for _, it := range g.Items { - if it.Id == id { - found = true - break - } - } - if !found { - return fmt.Errorf("SetDelivery: item id %d not found", id) - } - if slices.Contains(withDelivery, id) { - return fmt.Errorf("SetDelivery: item id %d already has a delivery", id) - } - targetItems = append(targetItems, id) - } - } - - if len(targetItems) == 0 { - return fmt.Errorf("SetDelivery: no eligible items to attach") - } - - // Append new delivery - g.mu.Lock() - g.lastDeliveryId++ - newId := g.lastDeliveryId - g.Deliveries = append(g.Deliveries, &CartDelivery{ - Id: newId, - Provider: m.Provider, - PickupPoint: m.PickupPoint, - Price: *NewPriceFromIncVat(4900, 25.0), - Items: targetItems, - }) - g.mu.Unlock() - - return nil -} diff --git a/pkg/cart/mutation_set_user_id.go b/pkg/cart/mutation_set_user_id.go index 222e633..14014d0 100644 --- a/pkg/cart/mutation_set_user_id.go +++ b/pkg/cart/mutation_set_user_id.go @@ -3,7 +3,7 @@ package cart import ( "errors" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" ) func SetUserId(grain *CartGrain, req *messages.SetUserId) error { diff --git a/pkg/cart/mutation_subscription_added.go b/pkg/cart/mutation_subscription_added.go index c3f31a7..7a488d2 100644 --- a/pkg/cart/mutation_subscription_added.go +++ b/pkg/cart/mutation_subscription_added.go @@ -3,13 +3,11 @@ package cart import ( "fmt" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" ) func SubscriptionAdded(grain *CartGrain, req *messages.SubscriptionAdded) error { - if grain.PaymentInProgress > 0 { - return ErrPaymentInProgress - } + for i, item := range grain.Items { if item.Id == req.ItemId { grain.Items[i].SubscriptionDetailsId = req.DetailsId diff --git a/pkg/cart/mutation_test.go b/pkg/cart/mutation_test.go deleted file mode 100644 index 295cb21..0000000 --- a/pkg/cart/mutation_test.go +++ /dev/null @@ -1,809 +0,0 @@ -package cart - -import ( - "context" - "encoding/json" - "fmt" - "reflect" - "slices" - "strings" - "testing" - "time" - - "github.com/matst80/go-redis-inventory/pkg/inventory" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" - - "git.k6n.net/go-cart-actor/pkg/actor" - messages "git.k6n.net/go-cart-actor/pkg/messages" -) - -// ---------------------- -// Helper constructors -// ---------------------- - -func newTestGrain() *CartGrain { - return NewCartGrain(123, time.Now()) -} - -type MockReservationService struct { -} - -func (m *MockReservationService) ReserveForCart(ctx context.Context, req inventory.CartReserveRequest) error { - return nil -} - -func (m *MockReservationService) ReleaseForCart(ctx context.Context, sku inventory.SKU, locationID inventory.LocationID, cartID inventory.CartID) error { - return nil -} - -func (m *MockReservationService) GetAvailableInventory(ctx context.Context, sku inventory.SKU, locationID inventory.LocationID) (int64, error) { - return 1000, nil -} - -func (m *MockReservationService) GetReservationExpiry(ctx context.Context, sku inventory.SKU, locationID inventory.LocationID, cartID inventory.CartID) (time.Time, error) { - return time.Time{}, nil -} - -func (m *MockReservationService) GetReservationStatus(ctx context.Context, sku inventory.SKU, locationID inventory.LocationID, cartID inventory.CartID) (*inventory.ReservationStatus, error) { - return nil, nil -} - -func (m *MockReservationService) GetReservationSummary(ctx context.Context, sku inventory.SKU, locationID inventory.LocationID) (*inventory.ReservationSummary, error) { - return nil, nil -} - -func newRegistry() actor.MutationRegistry { - cartCtx := &CartMutationContext{ - reservationService: &MockReservationService{}, - } - return NewCartMultationRegistry(cartCtx) -} - -func msgAddItem(sku string, price int64, qty int32, storePtr *string) *messages.AddItem { - return &messages.AddItem{ - Sku: sku, - Price: price, - Quantity: qty, - // Tax left 0 -> handler uses default 25% - StoreId: storePtr, - } -} - -func msgChangeQty(id uint32, qty int32) *messages.ChangeQuantity { - return &messages.ChangeQuantity{Id: id, Quantity: qty} -} - -func msgRemoveItem(id uint32) *messages.RemoveItem { - return &messages.RemoveItem{Id: id} -} - -func msgSetDelivery(provider string, items ...uint32) *messages.SetDelivery { - uitems := make([]uint32, len(items)) - copy(uitems, items) - return &messages.SetDelivery{Provider: provider, Items: uitems} -} - -func msgSetPickupPoint(deliveryId uint32, id string) *messages.SetPickupPoint { - return &messages.SetPickupPoint{ - DeliveryId: deliveryId, - Id: id, - Name: ptr("Pickup"), - Address: ptr("Street 1"), - City: ptr("Town"), - Zip: ptr("12345"), - Country: ptr("SE"), - } -} - -func msgClearCart() *messages.ClearCartRequest { - return &messages.ClearCartRequest{} -} - -func msgAddVoucher(code string, value int64, rules ...string) *messages.AddVoucher { - return &messages.AddVoucher{Code: code, Value: value, VoucherRules: rules} -} - -func msgRemoveVoucher(id uint32) *messages.RemoveVoucher { - return &messages.RemoveVoucher{Id: id} -} - -func msgInitializeCheckout(orderId, status string, inProgress bool) *messages.InitializeCheckout { - return &messages.InitializeCheckout{OrderId: orderId, Status: status, PaymentInProgress: inProgress} -} - -func msgOrderCreated(orderId, status string) *messages.OrderCreated { - return &messages.OrderCreated{OrderId: orderId, Status: status} -} - -func msgSetUserId(userId string) *messages.SetUserId { - return &messages.SetUserId{UserId: userId} -} - -func msgLineItemMarking(id uint32, typ uint32, marking string) *messages.LineItemMarking { - return &messages.LineItemMarking{Id: id, Type: typ, Marking: marking} -} - -func msgRemoveLineItemMarking(id uint32) *messages.RemoveLineItemMarking { - return &messages.RemoveLineItemMarking{Id: id} -} - -func msgSubscriptionAdded(itemId uint32, detailsId, orderRef string) *messages.SubscriptionAdded { - return &messages.SubscriptionAdded{ItemId: itemId, DetailsId: detailsId, OrderReference: orderRef} -} - -// func msgPaymentDeclined(message, code string) *messages.PaymentDeclined { -// return &messages.PaymentDeclined{Message: message, Code: &code} -// } - -func msgConfirmationViewed() *messages.ConfirmationViewed { - return &messages.ConfirmationViewed{} -} - -func msgCreateCheckoutOrder(terms, country string) *messages.CreateCheckoutOrder { - return &messages.CreateCheckoutOrder{Terms: terms, Country: country} -} - -func msgAddGiftcard(value int64, deliveryDate, recipient, recipientType, message string, designConfig *anypb.Any) *messages.AddGiftcard { - return &messages.AddGiftcard{ - Giftcard: &messages.GiftcardItem{ - Value: value, - DeliveryDate: deliveryDate, - Recipient: recipient, - RecipientType: recipientType, - Message: message, - DesignConfig: designConfig, - }, - } -} - -func msgRemoveGiftcard(id uint32) *messages.RemoveGiftcard { - return &messages.RemoveGiftcard{Id: id} -} - -func ptr[T any](v T) *T { return &v } - -// ---------------------- -// Apply helpers -// ---------------------- - -func applyOne(t *testing.T, reg actor.MutationRegistry, g *CartGrain, msg proto.Message) actor.ApplyResult { - t.Helper() - results, err := reg.Apply(context.Background(), g, msg) - if err != nil { - t.Fatalf("unexpected registry-level error applying %T: %v", msg, err) - } - if len(results) != 1 { - t.Fatalf("expected exactly one ApplyResult, got %d", len(results)) - } - return results[0] -} - -// Expect success (nil error inside ApplyResult). -func applyOK(t *testing.T, reg actor.MutationRegistry, g *CartGrain, msg proto.Message) { - t.Helper() - res := applyOne(t, reg, g, msg) - if res.Error != nil { - t.Fatalf("expected mutation %s (%T) to succeed, got error: %v", res.Type, msg, res.Error) - } -} - -// Expect an error matching substring. -func applyErrorContains(t *testing.T, reg actor.MutationRegistry, g *CartGrain, msg proto.Message, substr string) { - t.Helper() - res := applyOne(t, reg, g, msg) - if res.Error == nil { - t.Fatalf("expected error applying %T, got nil", msg) - } - if substr != "" && !strings.Contains(res.Error.Error(), substr) { - t.Fatalf("error mismatch, want substring %q got %q", substr, res.Error.Error()) - } -} - -// ---------------------- -// Tests -// ---------------------- - -func TestMutationRegistryCoverage(t *testing.T) { - reg := newRegistry() - - expected := []string{ - "AddItem", - "ChangeQuantity", - "RemoveItem", - "InitializeCheckout", - "OrderCreated", - "RemoveDelivery", - "SetDelivery", - "SetPickupPoint", - "ClearCartRequest", - "AddVoucher", - "RemoveVoucher", - "UpsertSubscriptionDetails", - "InventoryReserved", - "PreConditionFailed", - "SetUserId", - "LineItemMarking", - "RemoveLineItemMarking", - "SubscriptionAdded", - "PaymentDeclined", - "ConfirmationViewed", - "CreateCheckoutOrder", - "AddGiftcard", - "RemoveGiftcard", - } - - names := reg.(*actor.ProtoMutationRegistry).RegisteredMutations() - for _, want := range expected { - if !slices.Contains(names, want) { - t.Fatalf("registry missing mutation %s; got %v", want, names) - } - } - - // Create() by name returns correct concrete type. - for _, name := range expected { - msg, ok := reg.Create(name) - if !ok { - t.Fatalf("Create failed for %s", name) - } - rt := reflect.TypeOf(msg) - if rt.Kind() == reflect.Ptr { - rt = rt.Elem() - } - if rt.Name() != name { - t.Fatalf("Create(%s) returned wrong type %s", name, rt.Name()) - } - } - - // Unregistered create - if m, ok := reg.Create("DoesNotExist"); ok || m != nil { - t.Fatalf("Create should fail for unknown; got (%T,%v)", m, ok) - } - - // GetTypeName sanity - add := &messages.AddItem{} - nm, ok := reg.GetTypeName(add) - if !ok || nm != "AddItem" { - t.Fatalf("GetTypeName failed for AddItem, got (%q,%v)", nm, ok) - } - - // Apply unregistered message -> should return error - results, err := reg.Apply(context.Background(), newTestGrain(), &messages.Noop{}) - if err == nil { - t.Fatalf("expected error for unregistered mutation") - } - if len(results) != 1 || results[0].Error == nil || results[0].Error != actor.ErrMutationNotRegistered { - t.Fatalf("expected ApplyResult with ErrMutationNotRegistered, got %#v", results) - } -} - -func TestAddItemAndMerging(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - // Merge scenario (same SKU + same store pointer) - add1 := msgAddItem("SKU-1", 1000, 2, nil) - applyOK(t, reg, g, add1) - - if len(g.Items) != 1 || g.Items[0].Quantity != 2 { - t.Fatalf("expected first item added; items=%d qty=%d", len(g.Items), g.Items[0].Quantity) - } - - applyOK(t, reg, g, msgAddItem("SKU-1", 1000, 3, nil)) // should merge - if len(g.Items) != 1 || g.Items[0].Quantity != 5 { - t.Fatalf("expected merge quantity=5 items=%d qty=%d", len(g.Items), g.Items[0].Quantity) - } - - // Different store pointer -> new line - store := "S1" - applyOK(t, reg, g, msgAddItem("SKU-1", 1000, 1, &store)) - if len(g.Items) != 2 { - t.Fatalf("expected second line for different store pointer; items=%d", len(g.Items)) - } - - // Same store pointer & SKU -> merge with second line - applyOK(t, reg, g, msgAddItem("SKU-1", 1000, 4, &store)) - if len(g.Items) != 2 || g.Items[1].Quantity != 5 { - t.Fatalf("expected merge on second line; items=%d second.qty=%d", len(g.Items), g.Items[1].Quantity) - } - - // Invalid quantity - applyErrorContains(t, reg, g, msgAddItem("BAD", 1000, 0, nil), "invalid quantity") -} - -func TestChangeQuantityBehavior(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgAddItem("A", 1500, 2, nil)) - id := g.Items[0].Id - - // Increase quantity - applyOK(t, reg, g, msgChangeQty(id, 5)) - if g.Items[0].Quantity != 5 { - t.Fatalf("quantity not updated expected=5 got=%d", g.Items[0].Quantity) - } - - // Remove item by setting <=0 - applyOK(t, reg, g, msgChangeQty(id, 0)) - if len(g.Items) != 0 { - t.Fatalf("expected item removed; items=%d", len(g.Items)) - } - - // Not found - applyErrorContains(t, reg, g, msgChangeQty(9999, 1), "not found") -} - -func TestRemoveItemBehavior(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgAddItem("X", 1200, 1, nil)) - id := g.Items[0].Id - - applyOK(t, reg, g, msgRemoveItem(id)) - if len(g.Items) != 0 { - t.Fatalf("expected item removed; items=%d", len(g.Items)) - } - - applyErrorContains(t, reg, g, msgRemoveItem(id), "not found") -} - -func TestDeliveryMutations(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgAddItem("D1", 1000, 1, nil)) - applyOK(t, reg, g, msgAddItem("D2", 2000, 1, nil)) - i1 := g.Items[0].Id - - // Explicit items - applyOK(t, reg, g, msgSetDelivery("POSTNORD", i1)) - if len(g.Deliveries) != 1 || len(g.Deliveries[0].Items) != 1 || g.Deliveries[0].Items[0] != i1 { - t.Fatalf("delivery not created as expected: %+v", g.Deliveries) - } - - // Attempt to attach an already-delivered item - applyErrorContains(t, reg, g, msgSetDelivery("POSTNORD", i1), "already has a delivery") - - // Attach remaining item via empty list (auto include items without delivery) - applyOK(t, reg, g, msgSetDelivery("DHL")) - if len(g.Deliveries) != 2 { - t.Fatalf("expected second delivery; deliveries=%d", len(g.Deliveries)) - } - - // Non-existent item - applyErrorContains(t, reg, g, msgSetDelivery("UPS", 99999), "not found") - - // No eligible items left - applyErrorContains(t, reg, g, msgSetDelivery("UPS"), "no eligible items") - - // Set pickup point on first delivery - did := g.Deliveries[0].Id - applyOK(t, reg, g, msgSetPickupPoint(did, "PP1")) - if g.Deliveries[0].PickupPoint == nil || g.Deliveries[0].PickupPoint.Id != "PP1" { - t.Fatalf("pickup point not set correctly: %+v", g.Deliveries[0].PickupPoint) - } - - // Bad delivery id - applyErrorContains(t, reg, g, msgSetPickupPoint(9999, "PPX"), "delivery id") - - // Remove delivery - applyOK(t, reg, g, &messages.RemoveDelivery{Id: did}) - if len(g.Deliveries) != 1 || g.Deliveries[0].Id == did { - t.Fatalf("expected first delivery removed, remaining: %+v", g.Deliveries) - } - - // Remove delivery not found - applyErrorContains(t, reg, g, &messages.RemoveDelivery{Id: did}, "not found") -} - -func TestClearCart(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgAddItem("X", 1000, 2, nil)) - applyOK(t, reg, g, msgSetDelivery("P", g.Items[0].Id)) - - applyOK(t, reg, g, msgClearCart()) - - if len(g.Items) != 0 || len(g.Deliveries) != 0 { - t.Fatalf("expected cart cleared; items=%d deliveries=%d", len(g.Items), len(g.Deliveries)) - } -} - -func TestVoucherMutations(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgAddItem("VOUCH", 10000, 1, nil)) - applyOK(t, reg, g, msgAddVoucher("PROMO", 5000)) - - if len(g.Vouchers) != 1 { - t.Fatalf("voucher not stored") - } - if g.TotalDiscount.IncVat != 5000 { - t.Fatalf("expected discount 5000 got %d", g.TotalDiscount.IncVat) - } - if g.TotalPrice.IncVat != 5000 { - t.Fatalf("expected total price 5000 got %d", g.TotalPrice.IncVat) - } - - // Duplicate voucher code - applyErrorContains(t, reg, g, msgAddVoucher("PROMO", 1000), "already applied") - - // Add a large voucher (should not apply because value > total price) - applyOK(t, reg, g, msgAddVoucher("BIG", 100000)) - if len(g.Vouchers) != 2 { - t.Fatalf("expected second voucher stored") - } - if g.TotalDiscount.IncVat != 5000 || g.TotalPrice.IncVat != 5000 { - t.Fatalf("large voucher incorrectly applied discount=%d total=%d", - g.TotalDiscount.IncVat, g.TotalPrice.IncVat) - } - - // Remove existing voucher - firstId := g.Vouchers[0].Id - applyOK(t, reg, g, msgRemoveVoucher(firstId)) - - if slices.ContainsFunc(g.Vouchers, func(v *Voucher) bool { return v.Id == firstId }) { - t.Fatalf("voucher id %d not removed", firstId) - } - // After removing PROMO, BIG remains but is not applied (exceeds price) - if g.TotalDiscount.IncVat != 0 || g.TotalPrice.IncVat != 10000 { - t.Fatalf("totals incorrect after removal discount=%d total=%d", - g.TotalDiscount.IncVat, g.TotalPrice.IncVat) - } - - // Remove not applied - applyErrorContains(t, reg, g, msgRemoveVoucher(firstId), "not applied") -} - -// func TestCheckoutMutations(t *testing.T) { -// reg := newRegistry() -// g := newTestGrain() - -// applyOK(t, reg, g, msgInitializeCheckout("ORD-1", "PENDING", true)) -// if g.OrderReference != "ORD-1" || g.PaymentStatus != "PENDING" || !g.PaymentInProgress { -// t.Fatalf("initialize checkout failed: ref=%s status=%s inProgress=%v", -// g.OrderReference, g.PaymentStatus, g.PaymentInProgress) -// } - -// applyOK(t, reg, g, msgOrderCreated("ORD-1", "COMPLETED")) -// if g.OrderReference != "ORD-1" || g.PaymentStatus != "COMPLETED" || g.PaymentInProgress { -// t.Fatalf("order created mutation failed: ref=%s status=%s inProgress=%v", -// g.OrderReference, g.PaymentStatus, g.PaymentInProgress) -// } - -// applyErrorContains(t, reg, g, msgInitializeCheckout("", "X", true), "missing orderId") -// applyErrorContains(t, reg, g, msgOrderCreated("", "X"), "missing orderId") -// } - -func TestSubscriptionDetailsMutation(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - // Upsert new (Id == nil) - msgNew := &messages.UpsertSubscriptionDetails{ - OfferingCode: "OFF1", - SigningType: "TYPE1", - } - applyOK(t, reg, g, msgNew) - if len(g.SubscriptionDetails) != 1 { - t.Fatalf("expected one subscription detail; got=%d", len(g.SubscriptionDetails)) - } - - // Capture created id - var createdId string - for k := range g.SubscriptionDetails { - createdId = k - } - - // Update existing - msgUpdate := &messages.UpsertSubscriptionDetails{ - Id: &createdId, - OfferingCode: "OFF2", - SigningType: "TYPE2", - } - applyOK(t, reg, g, msgUpdate) - if g.SubscriptionDetails[createdId].OfferingCode != "OFF2" || - g.SubscriptionDetails[createdId].SigningType != "TYPE2" { - t.Fatalf("subscription details not updated: %+v", g.SubscriptionDetails[createdId]) - } - - // Update non-existent - badId := "NON_EXISTENT" - applyErrorContains(t, reg, g, &messages.UpsertSubscriptionDetails{Id: &badId}, "not found") - - // Nil mutation should be ignored and produce zero results. - resultsNil, errNil := reg.Apply(context.Background(), g, (*messages.UpsertSubscriptionDetails)(nil)) - if errNil != nil { - t.Fatalf("unexpected error for nil mutation element: %v", errNil) - } - if len(resultsNil) != 0 { - t.Fatalf("expected zero results for nil mutation, got %d", len(resultsNil)) - } -} - -// Ensure registry Apply handles nil grain and nil message defensive errors consistently. -func TestRegistryDefensiveErrors(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - // Nil grain - results, err := reg.Apply(context.Background(), nil, &messages.AddItem{}) - if err == nil { - t.Fatalf("expected error for nil grain") - } - if len(results) != 0 { - t.Fatalf("expected no results for nil grain") - } - - // Nil message slice - results, _ = reg.Apply(context.Background(), g, nil) - - if len(results) != 0 { - t.Fatalf("expected no results when message slice nil") - } -} - -type SubscriptionDetailsRequest struct { - Id *string `json:"id,omitempty"` - OfferingCode string `json:"offeringCode,omitempty"` - SigningType string `json:"signingType,omitempty"` - Data json.RawMessage `json:"data,omitempty"` -} - -func (sd *SubscriptionDetailsRequest) ToMessage() *messages.UpsertSubscriptionDetails { - return &messages.UpsertSubscriptionDetails{ - Id: sd.Id, - OfferingCode: sd.OfferingCode, - SigningType: sd.SigningType, - Data: &anypb.Any{Value: sd.Data}, - } -} - -func TestSubscriptionDetailsJSONValidation(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - // Valid JSON on create - jsonStr := `{"offeringCode": "OFFJSON", "signingType": "TYPEJSON", "data": {"value":"test","a":1}}` - var validCreate SubscriptionDetailsRequest - if err := json.Unmarshal([]byte(jsonStr), &validCreate); err != nil { - t.Fatal(err) - } - applyOK(t, reg, g, validCreate.ToMessage()) - if len(g.SubscriptionDetails) != 1 { - t.Fatalf("expected one subscription detail after valid create, got %d", len(g.SubscriptionDetails)) - } - var id string - for k := range g.SubscriptionDetails { - id = k - } - if string(g.SubscriptionDetails[id].Meta) != `{"value":"test","a":1}` { - t.Fatalf("expected meta stored as valid json, got %s", string(g.SubscriptionDetails[id].Meta)) - } - - // Update with valid JSON replaces meta - jsonStr2 := fmt.Sprintf(`{"id": "%s", "data": {"value": "eyJjaGFuZ2VkIjoxMjN9"}}`, id) - var updateValid messages.UpsertSubscriptionDetails - if err := json.Unmarshal([]byte(jsonStr2), &updateValid); err != nil { - t.Fatal(err) - } - applyOK(t, reg, g, &updateValid) - if string(g.SubscriptionDetails[id].Meta) != `{"changed":123}` { - t.Fatalf("expected meta updated to new json, got %s", string(g.SubscriptionDetails[id].Meta)) - } - - // Invalid JSON on create - jsonStr3 := `{"offeringCode": "BAD", "signingType": "TYPE", "data": {"value": "eyJicm9rZW4iO30="}}` - var invalidCreate messages.UpsertSubscriptionDetails - if err := json.Unmarshal([]byte(jsonStr3), &invalidCreate); err != nil { - t.Fatal(err) - } - res := applyOne(t, reg, g, &invalidCreate) - if res.Error == nil || !strings.Contains(res.Error.Error(), "invalid json") { - t.Fatalf("expected invalid json error on create, got %v", res.Error) - } - - // Invalid JSON on update - jsonStr4 := fmt.Sprintf(`{"id": "%s", "data": {"value": "e29vcHM="}}`, id) - var badUpdate messages.UpsertSubscriptionDetails - if err := json.Unmarshal([]byte(jsonStr4), &badUpdate); err != nil { - t.Fatal(err) - } - res2 := applyOne(t, reg, g, &badUpdate) - if res2.Error == nil || !strings.Contains(res2.Error.Error(), "invalid json") { - t.Fatalf("expected invalid json error on update, got %v", res2.Error) - } - - // Empty Data should not overwrite existing meta - jsonStr5 := fmt.Sprintf(`{"id": "%s"}`, id) - var emptyUpdate messages.UpsertSubscriptionDetails - if err := json.Unmarshal([]byte(jsonStr5), &emptyUpdate); err != nil { - t.Fatal(err) - } - applyOK(t, reg, g, &emptyUpdate) - if string(g.SubscriptionDetails[id].Meta) != `{"changed":123}` { - t.Fatalf("empty update should not change meta, got %s", string(g.SubscriptionDetails[id].Meta)) - } -} - -func TestSetUserId(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgSetUserId("user123")) - if g.userId != "user123" { - t.Fatalf("expected userId=user123, got %s", g.userId) - } - - applyErrorContains(t, reg, g, msgSetUserId(""), "cannot be empty") -} - -func TestLineItemMarking(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgAddItem("MARK", 1000, 1, nil)) - id := g.Items[0].Id - - applyOK(t, reg, g, msgLineItemMarking(id, 1, "Gift message")) - if g.Items[0].Marking == nil || g.Items[0].Marking.Type != 1 || g.Items[0].Marking.Text != "Gift message" { - t.Fatalf("marking not set correctly: %+v", g.Items[0].Marking) - } - - applyErrorContains(t, reg, g, msgLineItemMarking(9999, 2, "Test"), "not found") -} - -func TestRemoveLineItemMarking(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgAddItem("REMOVE", 1000, 1, nil)) - id := g.Items[0].Id - - // First set a marking - applyOK(t, reg, g, msgLineItemMarking(id, 1, "Test marking")) - if g.Items[0].Marking == nil || g.Items[0].Marking.Text != "Test marking" { - t.Fatalf("marking not set") - } - - // Now remove it - applyOK(t, reg, g, msgRemoveLineItemMarking(id)) - if g.Items[0].Marking != nil { - t.Fatalf("marking not removed") - } - - applyErrorContains(t, reg, g, msgRemoveLineItemMarking(9999), "not found") -} - -func TestSubscriptionAdded(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgAddItem("SUB", 1000, 1, nil)) - id := g.Items[0].Id - - applyOK(t, reg, g, msgSubscriptionAdded(id, "det123", "ord456")) - if g.Items[0].SubscriptionDetailsId != "det123" || g.Items[0].OrderReference != "ord456" || !g.Items[0].IsSubscribed { - t.Fatalf("subscription not added: detailsId=%s orderRef=%s isSubscribed=%v", - g.Items[0].SubscriptionDetailsId, g.Items[0].OrderReference, g.Items[0].IsSubscribed) - } - - applyErrorContains(t, reg, g, msgSubscriptionAdded(9999, "", ""), "not found") -} - -// func TestPaymentDeclined(t *testing.T) { -// reg := newRegistry() -// g := newTestGrain() - -// applyOK(t, reg, g, msgPaymentDeclined("Payment failed due to insufficient funds", "INSUFFICIENT_FUNDS")) - -// if g.PaymentStatus != "declined" || g.CheckoutOrderId != "" { -// t.Fatalf("payment declined not handled: status=%s checkoutId=%s", g.PaymentStatus, g.CheckoutOrderId) -// } -// if len(g.PaymentDeclinedNotices) != 1 { -// t.Fatalf("expected 1 notice, got %d", len(g.PaymentDeclinedNotices)) -// } -// notice := g.PaymentDeclinedNotices[0] -// if notice.Message != "Payment failed due to insufficient funds" { -// t.Fatalf("notice message not set correctly: %s", notice.Message) -// } -// if notice.Code == nil || *notice.Code != "INSUFFICIENT_FUNDS" { -// t.Fatalf("notice code not set correctly: %v", notice.Code) -// } -// if notice.Timestamp.IsZero() { -// t.Fatalf("notice timestamp not set") -// } -// } - -func TestConfirmationViewed(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - // Initial state - if g.Confirmation != nil { - t.Fatalf("confirmation should be nil, got %v", g.Confirmation) - } - - // First view - applyOK(t, reg, g, msgConfirmationViewed()) - if g.Confirmation.ViewCount != 1 { - t.Fatalf("view count should be 1, got %d", g.Confirmation.ViewCount) - } - if g.Confirmation.LastViewedAt.IsZero() { - t.Fatalf("ConfirmationLastViewedAt not set") - } - firstTime := g.Confirmation.LastViewedAt - - // Second view - applyOK(t, reg, g, msgConfirmationViewed()) - if g.Confirmation.ViewCount != 2 { - t.Fatalf("view count should be 2, got %d", g.Confirmation.ViewCount) - } - if g.Confirmation.LastViewedAt == firstTime { - t.Fatalf("ConfirmationLastViewedAt should have updated") - } -} - -func TestCreateCheckoutOrder(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgAddItem("CHECKOUT", 1000, 1, nil)) - - applyOK(t, reg, g, msgCreateCheckoutOrder("accepted", "SE")) - // if g.CheckoutOrderId == "" || g.CheckoutStatus != "pending" || g.CheckoutCountry != "SE" { - // t.Fatalf("checkout order not created: id=%s status=%s country=%s", - // g.CheckoutOrderId, g.CheckoutStatus, g.CheckoutCountry) - // } - - // Empty cart - g2 := newTestGrain() - applyErrorContains(t, reg, g2, msgCreateCheckoutOrder("accepted", ""), "empty cart") - - // Terms not accepted - applyErrorContains(t, reg, g, msgCreateCheckoutOrder("no", ""), "terms must be accepted") -} - -func TestAddGiftcard(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - designConfig, _ := anypb.New(&messages.AddItem{}) // example - applyOK(t, reg, g, msgAddGiftcard(5000, "2023-12-25", "John", "email", "Happy Birthday!", designConfig)) - - if len(g.Giftcards) != 1 { - t.Fatalf("expected 1 giftcard, got %d", len(g.Giftcards)) - } - gc := g.Giftcards[0] - if gc.Value.IncVat != 5000 || gc.DeliveryDate != "2023-12-25" || gc.Recipient != "John" || gc.RecipientType != "email" || gc.Message != "Happy Birthday!" { - t.Fatalf("giftcard not set correctly: %+v", gc) - } - if g.TotalPrice.IncVat != 5000 { - t.Fatalf("total price not updated, got %d", g.TotalPrice.IncVat) - } - - // Test invalid value - applyErrorContains(t, reg, g, msgAddGiftcard(0, "", "", "", "", nil), "must be positive") -} - -func TestRemoveGiftcard(t *testing.T) { - reg := newRegistry() - g := newTestGrain() - - applyOK(t, reg, g, msgAddGiftcard(1000, "2023-01-01", "Jane", "sms", "Cheers!", nil)) - id := g.Giftcards[0].Id - - applyOK(t, reg, g, msgRemoveGiftcard(id)) - if len(g.Giftcards) != 0 { - t.Fatalf("giftcard not removed") - } - if g.TotalPrice.IncVat != 0 { - t.Fatalf("total price not updated after removal, got %d", g.TotalPrice.IncVat) - } - - applyErrorContains(t, reg, g, msgRemoveGiftcard(id), "not found") -} diff --git a/pkg/cart/mutation_upsert_subscriptiondetails.go b/pkg/cart/mutation_upsert_subscriptiondetails.go index cabbad1..e59a0ae 100644 --- a/pkg/cart/mutation_upsert_subscriptiondetails.go +++ b/pkg/cart/mutation_upsert_subscriptiondetails.go @@ -4,16 +4,14 @@ import ( "encoding/json" "fmt" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" ) func UpsertSubscriptionDetails(g *CartGrain, m *messages.UpsertSubscriptionDetails) error { if m == nil { return nil } - if g.PaymentInProgress > 0 { - return ErrPaymentInProgress - } + metaBytes := m.Data.GetValue() // Create new subscription details when Id is nil. diff --git a/pkg/checkout/checkout-grain.go b/pkg/checkout/checkout-grain.go new file mode 100644 index 0000000..ad57a2c --- /dev/null +++ b/pkg/checkout/checkout-grain.go @@ -0,0 +1,184 @@ +package checkout + +import ( + "encoding/json" + "sync" + "time" + + "git.k6n.net/go-cart-actor/pkg/cart" +) + +// CheckoutId is the same as CartId for simplicity +type CheckoutId = cart.CartId + +type PickupPoint struct { + DeliveryId uint32 `json:"deliveryId,omitempty"` + Id string `json:"id"` + Name *string `json:"name,omitempty"` + Address *string `json:"address,omitempty"` + City *string `json:"city,omitempty"` + Zip *string `json:"zip,omitempty"` + Country *string `json:"country,omitempty"` +} + +type CheckoutDelivery struct { + Id uint32 `json:"id"` + Provider string `json:"provider"` + Price cart.Price `json:"price"` + Items []uint32 `json:"items"` + PickupPoint *PickupPoint `json:"pickupPoint,omitempty"` +} +type PaymentStatus string +type CheckoutPaymentStatus PaymentStatus + +const ( + PaymentStatusPending PaymentStatus = "pending" + PaymentStatusFailed PaymentStatus = "failed" + PaymentStatusSuccess PaymentStatus = "success" + CheckoutPaymentStatusPending CheckoutPaymentStatus = "pending" + CheckoutPaymentStatusFailed CheckoutPaymentStatus = "failed" + CheckoutPaymentStatusSuccess CheckoutPaymentStatus = "success" + CheckoutPaymentStatusCancelled CheckoutPaymentStatus = "partial" +) + +type Payment struct { + PaymentId string `json:"paymentId"` + Status PaymentStatus `json:"status"` + Amount int64 `json:"amount"` + Currency string `json:"currency"` + Provider string `json:"provider,omitempty"` + Method *string `json:"method,omitempty"` + Events []*PaymentEvent `json:"events,omitempty"` + ProcessorReference *string `json:"processorReference,omitempty"` + StartedAt *time.Time `json:"startedAt,omitempty"` + CompletedAt *time.Time `json:"completedAt,omitempty"` +} + +type PaymentEvent struct { + Name string `json:"name"` + Success bool `json:"success"` + Data json.RawMessage `json:"data"` +} + +func (p *Payment) IsSettled() bool { + if p == nil { + return false + } + + switch p.Status { + case PaymentStatusSuccess: + return true + default: + return false + } +} + +type ConfirmationStatus struct { + Code *string `json:"code,omitempty"` + ViewCount int `json:"viewCount"` + LastViewedAt time.Time `json:"lastViewedAt"` +} + +type CheckoutGrain struct { + mu sync.RWMutex + lastDeliveryId uint32 + lastGiftcardId uint32 + lastAccess time.Time + lastChange time.Time + Version uint32 + Id CheckoutId `json:"id"` + CartId cart.CartId `json:"cartId"` + CartVersion uint64 `json:"cartVersion"` + CartState *cart.CartGrain `json:"cartState"` // snapshot of items + CartTotalPrice *cart.Price `json:"cartTotalPrice"` + OrderId *string `json:"orderId"` + Deliveries []*CheckoutDelivery `json:"deliveries,omitempty"` + PaymentInProgress uint16 `json:"paymentInProgress"` + InventoryReserved bool `json:"inventoryReserved"` + Confirmation *ConfirmationStatus `json:"confirmationViewed,omitempty"` + Payments []*Payment `json:"payments,omitempty"` +} + +func NewCheckoutGrain(id uint64, cartId cart.CartId, cartVersion uint64, ts time.Time, cartState *cart.CartGrain) *CheckoutGrain { + return &CheckoutGrain{ + lastDeliveryId: 0, + lastGiftcardId: 0, + lastAccess: ts, + lastChange: ts, + Id: CheckoutId(id), + CartId: cartId, + CartVersion: cartVersion, + Deliveries: []*CheckoutDelivery{}, + Payments: []*Payment{}, + CartState: cartState, + CartTotalPrice: cartState.TotalPrice, + } +} + +func (c *CheckoutGrain) GetId() uint64 { + return uint64(c.Id) +} + +func (c *CheckoutGrain) GetLastChange() time.Time { + return c.lastChange +} + +func (c *CheckoutGrain) GetLastAccess() time.Time { + return c.lastAccess +} + +func (c *CheckoutGrain) GetCurrentState() (*CheckoutGrain, error) { + c.lastAccess = time.Now() + return c, nil +} + +func (c *CheckoutGrain) GetState() ([]byte, error) { + return json.Marshal(c) +} + +func (c *CheckoutGrain) FindPayment(paymentId string) (*Payment, bool) { + if paymentId == "" { + return nil, false + } + for _, payment := range c.Payments { + if payment != nil && payment.PaymentId == paymentId { + return payment, true + } + } + return nil, false +} + +func (c *CheckoutGrain) SettledPayments() []*Payment { + if len(c.Payments) == 0 { + return nil + } + settled := make([]*Payment, 0, len(c.Payments)) + for _, payment := range c.Payments { + if payment != nil && payment.IsSettled() { + settled = append(settled, payment) + } + } + if len(settled) == 0 { + return nil + } + return settled +} + +func (c *CheckoutGrain) OpenPayments() []*Payment { + if len(c.Payments) == 0 { + return nil + } + pending := make([]*Payment, 0, len(c.Payments)) + for _, payment := range c.Payments { + if payment == nil { + continue + } + if !payment.IsSettled() { + pending = append(pending, payment) + } + } + if len(pending) == 0 { + return nil + } + return pending +} diff --git a/pkg/checkout/mutation-context.go b/pkg/checkout/mutation-context.go new file mode 100644 index 0000000..f4e71a4 --- /dev/null +++ b/pkg/checkout/mutation-context.go @@ -0,0 +1,35 @@ +package checkout + +import ( + "git.k6n.net/go-cart-actor/pkg/actor" + messages "git.k6n.net/go-cart-actor/proto/checkout" +) + +type CheckoutMutationContext struct { + // Add any services needed, e.g., for delivery calculations, but since inventory is pre-handled, maybe none +} + +func NewCheckoutMutationContext() *CheckoutMutationContext { + return &CheckoutMutationContext{} +} + +func NewCheckoutMutationRegistry(ctx *CheckoutMutationContext) actor.MutationRegistry { + reg := actor.NewMutationRegistry() + reg.RegisterMutations( + actor.NewMutation(HandleInitializeCheckout, func() *messages.InitializeCheckout { return &messages.InitializeCheckout{} }), + actor.NewMutation(HandlePaymentStarted, func() *messages.PaymentStarted { return &messages.PaymentStarted{} }), + actor.NewMutation(HandlePaymentCompleted, func() *messages.PaymentCompleted { return &messages.PaymentCompleted{} }), + actor.NewMutation(HandlePaymentDeclined, func() *messages.PaymentDeclined { return &messages.PaymentDeclined{} }), + actor.NewMutation(HandlePaymentEvent, func() *messages.PaymentEvent { return &messages.PaymentEvent{} }), + actor.NewMutation(HandleConfirmationViewed, func() *messages.ConfirmationViewed { return &messages.ConfirmationViewed{} }), + //actor.NewMutation(HandleCreateCheckoutOrder, func() *messages.CreateCheckoutOrder { return &messages.CreateCheckoutOrder{} }), + actor.NewMutation(HandleOrderCreated, func() *messages.OrderCreated { return &messages.OrderCreated{} }), + actor.NewMutation(HandleInventoryReserved, func() *messages.InventoryReserved { return &messages.InventoryReserved{} }), + actor.NewMutation(HandleSetDelivery, func() *messages.SetDelivery { return &messages.SetDelivery{} }), + actor.NewMutation(HandleSetPickupPoint, func() *messages.SetPickupPoint { return &messages.SetPickupPoint{} }), + actor.NewMutation(HandleRemoveDelivery, func() *messages.RemoveDelivery { return &messages.RemoveDelivery{} }), + // actor.NewMutation(HandleAddGiftcard, func() *messages.AddGiftcard { return &messages.AddGiftcard{} }), + // actor.NewMutation(HandleRemoveGiftcard, func() *messages.RemoveGiftcard { return &messages.RemoveGiftcard{} }), + ) + return reg +} diff --git a/pkg/checkout/mutation_confirmation_viewed.go b/pkg/checkout/mutation_confirmation_viewed.go new file mode 100644 index 0000000..f5b9dbf --- /dev/null +++ b/pkg/checkout/mutation_confirmation_viewed.go @@ -0,0 +1,26 @@ +package checkout + +import ( + "fmt" + "time" + + messages "git.k6n.net/go-cart-actor/proto/checkout" +) + +func HandleConfirmationViewed(g *CheckoutGrain, m *messages.ConfirmationViewed) error { + if m == nil { + return fmt.Errorf("ConfirmationViewed: nil payload") + } + + if g.Confirmation != nil { + g.Confirmation = &ConfirmationStatus{ + ViewCount: 1, + LastViewedAt: time.Now(), + } + } else { + g.Confirmation.ViewCount++ + g.Confirmation.LastViewedAt = time.Now() + } + + return nil +} diff --git a/pkg/checkout/mutation_delivery.go b/pkg/checkout/mutation_delivery.go new file mode 100644 index 0000000..d9c0492 --- /dev/null +++ b/pkg/checkout/mutation_delivery.go @@ -0,0 +1,55 @@ +package checkout + +import ( + "fmt" + + "git.k6n.net/go-cart-actor/pkg/cart" + messages "git.k6n.net/go-cart-actor/proto/checkout" +) + +func asPickupPoint(p *messages.PickupPoint, deliveryId uint32) *PickupPoint { + if p == nil { + return nil + } + return &PickupPoint{ + Id: p.Id, + Name: p.Name, + Address: p.Address, + City: p.City, + Country: p.Country, + Zip: p.Zip, + } +} + +// HandleSetDelivery mutation +// HandleSetDelivery mutation +func HandleSetDelivery(g *CheckoutGrain, m *messages.SetDelivery) error { + if m == nil { + return fmt.Errorf("HandleSetDelivery: nil payload") + } + if m.Provider == "" { + return fmt.Errorf("HandleSetDelivery: missing provider") + } + + // Check if delivery already exists, update or add + for _, d := range g.Deliveries { + if d.Provider == m.Provider { + // Update existing + d.Items = m.Items + d.PickupPoint = asPickupPoint(m.PickupPoint, d.Id) + return nil + } + } + + // Add new delivery + g.lastDeliveryId++ + delivery := &CheckoutDelivery{ + Id: g.lastDeliveryId, + Provider: m.Provider, + Items: m.Items, + PickupPoint: asPickupPoint(m.PickupPoint, g.lastDeliveryId), + Price: *cart.NewPrice(), // Price might need calculation, but for now zero + } + g.Deliveries = append(g.Deliveries, delivery) + return nil +} diff --git a/pkg/checkout/mutation_initialize_checkout.go b/pkg/checkout/mutation_initialize_checkout.go new file mode 100644 index 0000000..9e033ca --- /dev/null +++ b/pkg/checkout/mutation_initialize_checkout.go @@ -0,0 +1,44 @@ +package checkout + +import ( + "encoding/json" + "fmt" + + messages "git.k6n.net/go-cart-actor/proto/checkout" +) + +// mutation_initialize_checkout.go +// +// Registers the InitializeCheckout mutation. +// This mutation is invoked AFTER an external checkout session +// has been successfully created or updated. It persists the +// order reference / status and marks the checkout as having a payment in progress. +// +// Behavior: +// - Sets OrderId to the order ID. +// - Sets Status to the current status. +// - Sets PaymentInProgress flag. +// - Assumes inventory is already reserved. +// +// Validation: +// - Returns an error if payload is nil. +// - Returns an error if orderId is empty. + +func HandleInitializeCheckout(g *CheckoutGrain, m *messages.InitializeCheckout) error { + if m == nil { + return fmt.Errorf("InitializeCheckout: nil payload") + } + if m.OrderId == "" { + return fmt.Errorf("InitializeCheckout: missing orderId") + } + if m.CartState != nil { + return fmt.Errorf("InitializeCheckout: checkout already initialized") + } + + err := json.Unmarshal(m.CartState.Value, &g.CartState) + if err != nil { + return fmt.Errorf("InitializeCheckout: failed to unmarshal cart state: %w", err) + } + + return nil +} diff --git a/pkg/checkout/mutation_inventory_reserved.go b/pkg/checkout/mutation_inventory_reserved.go new file mode 100644 index 0000000..7702681 --- /dev/null +++ b/pkg/checkout/mutation_inventory_reserved.go @@ -0,0 +1,16 @@ +package checkout + +import ( + "fmt" + + messages "git.k6n.net/go-cart-actor/proto/checkout" +) + +func HandleInventoryReserved(g *CheckoutGrain, m *messages.InventoryReserved) error { + if m == nil { + return fmt.Errorf("HandleInventoryReserved: nil payload") + } + + g.InventoryReserved = m.Status == "success" + return nil +} diff --git a/pkg/cart/mutation_order_created.go b/pkg/checkout/mutation_order_created.go similarity index 55% rename from pkg/cart/mutation_order_created.go rename to pkg/checkout/mutation_order_created.go index 46dd8cc..409483e 100644 --- a/pkg/cart/mutation_order_created.go +++ b/pkg/checkout/mutation_order_created.go @@ -1,9 +1,9 @@ -package cart +package checkout import ( "fmt" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/checkout" ) // mutation_order_created.go @@ -11,21 +11,20 @@ import ( // Registers the OrderCreated mutation. // // This mutation represents the completion (or state transition) of an order -// initiated earlier via InitializeCheckout / external Klarna processing. -// It finalizes (or updates) the cart's order metadata. +// initiated earlier via InitializeCheckout / external processing. +// It finalizes (or updates) the checkout's order metadata. // // Behavior: // - Validates payload non-nil and OrderId not empty. -// - Sets (or overwrites) OrderReference with the provided OrderId. -// - Sets PaymentStatus from payload.Status. -// - Marks PaymentInProgress = false (checkout flow finished / acknowledged). -// - Does NOT adjust monetary totals (no WithTotals()). +// - Sets Status from payload.Status. +// - Sets OrderId if not already set. +// - Does NOT adjust monetary totals. // // Notes / Future Extensions: // - If multiple order completion events can arrive (e.g., retries / webhook // replays), this handler is idempotent: it simply overwrites fields. // - If you need to guard against conflicting order IDs, add a check: -// if g.OrderReference != "" && g.OrderReference != m.OrderId { ... } +// if g.OrderId != "" && g.OrderId != m.OrderId { ... } // - Add audit logging or metrics here if required. // // Concurrency: @@ -33,16 +32,18 @@ import ( // per grain. If out-of-order events are possible, embed versioning or // timestamps in the mutation and compare before applying changes. -func OrderCreated(g *CartGrain, m *messages.OrderCreated) error { +func HandleOrderCreated(g *CheckoutGrain, m *messages.OrderCreated) error { if m == nil { - return fmt.Errorf("OrderCreated: nil payload") + return fmt.Errorf("HandleOrderCreated: nil payload") } if m.OrderId == "" { return fmt.Errorf("OrderCreated: missing orderId") } + if g.OrderId == nil { + g.OrderId = &m.OrderId + } else if *g.OrderId != m.OrderId { + return fmt.Errorf("OrderCreated: conflicting order ID") + } - g.OrderReference = m.OrderId - //g.PaymentStatus = m.Status - //g.PaymentInProgress = false return nil } diff --git a/pkg/checkout/mutation_payment_completed.go b/pkg/checkout/mutation_payment_completed.go new file mode 100644 index 0000000..34b16c6 --- /dev/null +++ b/pkg/checkout/mutation_payment_completed.go @@ -0,0 +1,37 @@ +package checkout + +import ( + "fmt" + "time" + + messages "git.k6n.net/go-cart-actor/proto/checkout" +) + +// PaymentCompleted registers the completion of a payment for a checkout. +func HandlePaymentCompleted(g *CheckoutGrain, m *messages.PaymentCompleted) error { + if m == nil { + return fmt.Errorf("PaymentCompleted: nil payload") + } + paymentId := m.PaymentId + payment, found := g.FindPayment(paymentId) + + if !found { + return fmt.Errorf("PaymentCompleted: payment not found") + } + + payment.ProcessorReference = m.ProcessorReference + payment.Status = PaymentStatusSuccess + payment.Amount = m.Amount + payment.Currency = m.Currency + payment.CompletedAt = &time.Time{} + if m.CompletedAt != nil { + *payment.CompletedAt = m.CompletedAt.AsTime() + } else { + *payment.CompletedAt = time.Now() + } + + // Update checkout status + g.PaymentInProgress-- + + return nil +} diff --git a/pkg/checkout/mutation_payment_declined.go b/pkg/checkout/mutation_payment_declined.go new file mode 100644 index 0000000..dcccb9c --- /dev/null +++ b/pkg/checkout/mutation_payment_declined.go @@ -0,0 +1,28 @@ +package checkout + +import ( + "errors" + "time" + + messages "git.k6n.net/go-cart-actor/proto/checkout" +) + +func asPointer[T any](value T) *T { + return &value +} + +var ErrPaymentNotFound = errors.New("payment not found") + +func HandlePaymentDeclined(g *CheckoutGrain, m *messages.PaymentDeclined) error { + + payment, found := g.FindPayment(m.PaymentId) + if !found { + return ErrPaymentNotFound + } + + payment.CompletedAt = asPointer(time.Now()) + payment.Status = "failed" + g.PaymentInProgress-- + + return nil +} diff --git a/pkg/checkout/mutation_payment_event.go b/pkg/checkout/mutation_payment_event.go new file mode 100644 index 0000000..9069ebb --- /dev/null +++ b/pkg/checkout/mutation_payment_event.go @@ -0,0 +1,20 @@ +package checkout + +import ( + messages "git.k6n.net/go-cart-actor/proto/checkout" +) + +func HandlePaymentEvent(g *CheckoutGrain, m *messages.PaymentEvent) error { + + payment, found := g.FindPayment(m.PaymentId) + if !found { + return ErrPaymentNotFound + } + metaBytes := m.Data.Value + payment.Events = append(payment.Events, &PaymentEvent{ + Name: m.Name, + Success: m.Success, + Data: metaBytes, + }) + return nil +} diff --git a/pkg/cart/mutation_payment_started.go b/pkg/checkout/mutation_payment_started.go similarity index 57% rename from pkg/cart/mutation_payment_started.go rename to pkg/checkout/mutation_payment_started.go index ec8761a..83763eb 100644 --- a/pkg/cart/mutation_payment_started.go +++ b/pkg/checkout/mutation_payment_started.go @@ -1,48 +1,48 @@ -package cart +package checkout import ( "fmt" "strings" "time" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/checkout" ) -// PaymentStarted registers the beginning of a payment attempt for a cart. +// PaymentStarted registers the beginning of a payment attempt for a checkout. // It either upserts the payment entry (based on paymentId) or creates a new one, -// marks the cart as having an in-progress payment, and recalculates the PaidInFull flag. -func PaymentStarted(grain *CartGrain, msg *messages.PaymentStarted) error { - if msg == nil { +// marks the checkout as having a payment in progress. +func HandlePaymentStarted(g *CheckoutGrain, m *messages.PaymentStarted) error { + if m == nil { return fmt.Errorf("PaymentStarted: nil payload") } - paymentID := strings.TrimSpace(msg.PaymentId) + paymentID := strings.TrimSpace(m.PaymentId) if paymentID == "" { return fmt.Errorf("PaymentStarted: missing paymentId") } - if msg.Amount < 0 { + if m.Amount < 0 { return fmt.Errorf("PaymentStarted: amount cannot be negative") } - currency := strings.TrimSpace(msg.Currency) - provider := strings.TrimSpace(msg.Provider) - method := copyOptionalString(msg.Method) + currency := strings.TrimSpace(m.Currency) + provider := strings.TrimSpace(m.Provider) + method := copyOptionalString(m.Method) startedAt := time.Now().UTC() - if msg.StartedAt != nil { - startedAt = msg.StartedAt.AsTime() + if m.StartedAt != nil { + startedAt = m.StartedAt.AsTime() } - payment, found := grain.FindPayment(paymentID) + payment, found := g.FindPayment(paymentID) if found { - if payment.Status != PaymentStatusPending { + if payment.Status != "pending" { return fmt.Errorf("PaymentStarted: payment already started") } if payment.PaymentId != paymentID { payment.PaymentId = paymentID } - payment.Status = PaymentStatusPending - payment.Amount = msg.Amount + payment.Status = "pending" + payment.Amount = m.Amount if currency != "" { payment.Currency = currency } @@ -56,10 +56,11 @@ func PaymentStarted(grain *CartGrain, msg *messages.PaymentStarted) error { payment.CompletedAt = nil payment.ProcessorReference = nil } else { - grain.Payments = append(grain.Payments, &CartPayment{ + g.PaymentInProgress++ + g.Payments = append(g.Payments, &Payment{ PaymentId: paymentID, - Status: PaymentStatusPending, - Amount: msg.Amount, + Status: "pending", + Amount: m.Amount, Currency: currency, Provider: provider, Method: method, @@ -67,9 +68,6 @@ func PaymentStarted(grain *CartGrain, msg *messages.PaymentStarted) error { }) } - grain.PaymentInProgress++ - grain.PaymentStatus = PaymentStatusPending - return nil } diff --git a/pkg/checkout/mutation_payments.go b/pkg/checkout/mutation_payments.go new file mode 100644 index 0000000..8ff8f5c --- /dev/null +++ b/pkg/checkout/mutation_payments.go @@ -0,0 +1,3 @@ +package checkout + +// This file is now empty as mutations have been moved to separate files. diff --git a/pkg/cart/mutation_remove_delivery.go b/pkg/checkout/mutation_remove_delivery.go similarity index 52% rename from pkg/cart/mutation_remove_delivery.go rename to pkg/checkout/mutation_remove_delivery.go index e8b010c..fd1193b 100644 --- a/pkg/cart/mutation_remove_delivery.go +++ b/pkg/checkout/mutation_remove_delivery.go @@ -1,9 +1,9 @@ -package cart +package checkout import ( "fmt" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/checkout" ) // mutation_remove_delivery.go @@ -13,26 +13,13 @@ import ( // Behavior: // - Removes the delivery entry whose Id == payload.Id. // - If not found, returns an error. -// - Cart totals are recalculated (WithTotals) after removal. // - Items previously associated with that delivery simply become "without delivery"; // subsequent delivery mutations can reassign them. -// -// Differences vs legacy: -// - Legacy logic decremented TotalPrice explicitly before recalculating. -// Here we rely solely on UpdateTotals() to recompute from remaining -// deliveries and items (simpler / single source of truth). -// -// Future considerations: -// - If delivery pricing logic changes (e.g., dynamic taxes per delivery), -// UpdateTotals() may need enhancement to incorporate delivery tax properly. -func RemoveDelivery(g *CartGrain, m *messages.RemoveDelivery) error { +func HandleRemoveDelivery(g *CheckoutGrain, m *messages.RemoveDelivery) error { if m == nil { return fmt.Errorf("RemoveDelivery: nil payload") } - if g.PaymentInProgress > 0 { - return ErrPaymentInProgress - } targetID := uint32(m.Id) index := -1 for i, d := range g.Deliveries { @@ -47,6 +34,5 @@ func RemoveDelivery(g *CartGrain, m *messages.RemoveDelivery) error { // Remove delivery (order not preserved beyond necessity) g.Deliveries = append(g.Deliveries[:index], g.Deliveries[index+1:]...) - g.UpdateTotals() return nil } diff --git a/pkg/cart/mutation_set_pickup_point.go b/pkg/checkout/mutation_set_pickup_point.go similarity index 66% rename from pkg/cart/mutation_set_pickup_point.go rename to pkg/checkout/mutation_set_pickup_point.go index 0028478..cc7c630 100644 --- a/pkg/cart/mutation_set_pickup_point.go +++ b/pkg/checkout/mutation_set_pickup_point.go @@ -1,9 +1,9 @@ -package cart +package checkout import ( "fmt" - messages "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/checkout" ) // mutation_set_pickup_point.go @@ -29,37 +29,23 @@ import ( // - Track history / audit of pickup point changes // - Trigger delivery price adjustments (which would then require WithTotals()). -func SetPickupPoint(g *CartGrain, m *messages.SetPickupPoint) error { +func HandleSetPickupPoint(g *CheckoutGrain, m *messages.SetPickupPoint) error { if m == nil { return fmt.Errorf("SetPickupPoint: nil payload") } - if g.PaymentInProgress > 0 { - return ErrPaymentInProgress - } for _, d := range g.Deliveries { if d.Id == uint32(m.DeliveryId) { - d.PickupPoint = &messages.PickupPoint{ - Id: m.Id, - Name: m.Name, - Address: m.Address, - City: m.City, - Zip: m.Zip, - Country: m.Country, + d.PickupPoint = &PickupPoint{ + Id: m.PickupPoint.Id, + Name: m.PickupPoint.Name, + Address: m.PickupPoint.Address, + City: m.PickupPoint.City, + Zip: m.PickupPoint.Zip, + Country: m.PickupPoint.Country, } return nil } } return fmt.Errorf("SetPickupPoint: delivery id %d not found", m.DeliveryId) } - -func ClearCart(g *CartGrain, m *messages.ClearCartRequest) error { - if m == nil { - return fmt.Errorf("ClearCart: nil payload") - } - // maybe check if payment is done? - g.Deliveries = g.Deliveries[:0] - g.Items = g.Items[:0] - g.UpdateTotals() - return nil -} diff --git a/pkg/discovery/discovery.go b/pkg/discovery/discovery.go index 470a4fa..c050805 100644 --- a/pkg/discovery/discovery.go +++ b/pkg/discovery/discovery.go @@ -14,17 +14,16 @@ import ( ) type K8sDiscovery struct { - ctx context.Context - client *kubernetes.Clientset + ctx context.Context + client *kubernetes.Clientset + listOptions metav1.ListOptions } func (k *K8sDiscovery) Discover() ([]string, error) { return k.DiscoverInNamespace("") } func (k *K8sDiscovery) DiscoverInNamespace(namespace string) ([]string, error) { - pods, err := k.client.CoreV1().Pods(namespace).List(k.ctx, metav1.ListOptions{ - LabelSelector: "actor-pool=cart", - }) + pods, err := k.client.CoreV1().Pods(namespace).List(k.ctx, k.listOptions) if err != nil { return nil, err } @@ -44,14 +43,10 @@ func hasReadyCondition(pod *v1.Pod) bool { } func (k *K8sDiscovery) Watch() (<-chan HostChange, error) { - timeout := int64(30) ipsThatAreReady := make(map[string]bool) m := sync.Mutex{} watcherFn := func(options metav1.ListOptions) (watch.Interface, error) { - return k.client.CoreV1().Pods("").Watch(k.ctx, metav1.ListOptions{ - LabelSelector: "actor-pool=cart", - TimeoutSeconds: &timeout, - }) + return k.client.CoreV1().Pods("").Watch(k.ctx, k.listOptions) } watcher, err := toolsWatch.NewRetryWatcherWithContext(k.ctx, "1", &cache.ListWatch{WatchFunc: watcherFn}) if err != nil { @@ -82,9 +77,10 @@ func (k *K8sDiscovery) Watch() (<-chan HostChange, error) { return ch, nil } -func NewK8sDiscovery(client *kubernetes.Clientset) *K8sDiscovery { +func NewK8sDiscovery(client *kubernetes.Clientset, listOptions metav1.ListOptions) *K8sDiscovery { return &K8sDiscovery{ - ctx: context.Background(), - client: client, + ctx: context.Background(), + client: client, + listOptions: listOptions, } } diff --git a/pkg/discovery/discovery_test.go b/pkg/discovery/discovery_test.go index e2a955c..122d327 100644 --- a/pkg/discovery/discovery_test.go +++ b/pkg/discovery/discovery_test.go @@ -4,6 +4,7 @@ import ( "testing" "time" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" ) @@ -17,7 +18,9 @@ func TestDiscovery(t *testing.T) { if err != nil { t.Errorf("Error creating client: %v", err) } - d := NewK8sDiscovery(client) + d := NewK8sDiscovery(client, metav1.ListOptions{ + LabelSelector: "app", + }) res, err := d.DiscoverInNamespace("") if err != nil { t.Errorf("Error discovering: %v", err) @@ -36,7 +39,9 @@ func TestWatch(t *testing.T) { if err != nil { t.Errorf("Error creating client: %v", err) } - d := NewK8sDiscovery(client) + d := NewK8sDiscovery(client, metav1.ListOptions{ + LabelSelector: "app", + }) ch, err := d.Watch() if err != nil { t.Errorf("Error watching: %v", err) diff --git a/pkg/messages/messages.pb.go b/pkg/messages/messages.pb.go deleted file mode 100644 index 7c556a8..0000000 --- a/pkg/messages/messages.pb.go +++ /dev/null @@ -1,3000 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.5 -// protoc v6.33.1 -// source: messages.proto - -package messages - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ClearCartRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ClearCartRequest) Reset() { - *x = ClearCartRequest{} - mi := &file_messages_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ClearCartRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClearCartRequest) ProtoMessage() {} - -func (x *ClearCartRequest) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClearCartRequest.ProtoReflect.Descriptor instead. -func (*ClearCartRequest) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{0} -} - -type AddItem struct { - state protoimpl.MessageState `protogen:"open.v1"` - ItemId uint32 `protobuf:"varint,1,opt,name=item_id,json=itemId,proto3" json:"item_id,omitempty"` - Quantity int32 `protobuf:"varint,2,opt,name=quantity,proto3" json:"quantity,omitempty"` - Price int64 `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"` - OrgPrice int64 `protobuf:"varint,9,opt,name=orgPrice,proto3" json:"orgPrice,omitempty"` - Sku string `protobuf:"bytes,4,opt,name=sku,proto3" json:"sku,omitempty"` - Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` - Image string `protobuf:"bytes,6,opt,name=image,proto3" json:"image,omitempty"` - Stock int32 `protobuf:"varint,7,opt,name=stock,proto3" json:"stock,omitempty"` - Tax int32 `protobuf:"varint,8,opt,name=tax,proto3" json:"tax,omitempty"` - Brand string `protobuf:"bytes,13,opt,name=brand,proto3" json:"brand,omitempty"` - Category string `protobuf:"bytes,14,opt,name=category,proto3" json:"category,omitempty"` - Category2 string `protobuf:"bytes,15,opt,name=category2,proto3" json:"category2,omitempty"` - Category3 string `protobuf:"bytes,16,opt,name=category3,proto3" json:"category3,omitempty"` - Category4 string `protobuf:"bytes,17,opt,name=category4,proto3" json:"category4,omitempty"` - Category5 string `protobuf:"bytes,18,opt,name=category5,proto3" json:"category5,omitempty"` - Disclaimer string `protobuf:"bytes,10,opt,name=disclaimer,proto3" json:"disclaimer,omitempty"` - ArticleType string `protobuf:"bytes,11,opt,name=articleType,proto3" json:"articleType,omitempty"` - SellerId string `protobuf:"bytes,19,opt,name=sellerId,proto3" json:"sellerId,omitempty"` - SellerName string `protobuf:"bytes,20,opt,name=sellerName,proto3" json:"sellerName,omitempty"` - Country string `protobuf:"bytes,21,opt,name=country,proto3" json:"country,omitempty"` - SaleStatus string `protobuf:"bytes,24,opt,name=saleStatus,proto3" json:"saleStatus,omitempty"` - Outlet *string `protobuf:"bytes,12,opt,name=outlet,proto3,oneof" json:"outlet,omitempty"` - StoreId *string `protobuf:"bytes,22,opt,name=storeId,proto3,oneof" json:"storeId,omitempty"` - ParentId *uint32 `protobuf:"varint,23,opt,name=parentId,proto3,oneof" json:"parentId,omitempty"` - Cgm string `protobuf:"bytes,25,opt,name=cgm,proto3" json:"cgm,omitempty"` - ReservationEndTime *timestamppb.Timestamp `protobuf:"bytes,26,opt,name=reservationEndTime,proto3,oneof" json:"reservationEndTime,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AddItem) Reset() { - *x = AddItem{} - mi := &file_messages_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AddItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddItem) ProtoMessage() {} - -func (x *AddItem) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddItem.ProtoReflect.Descriptor instead. -func (*AddItem) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{1} -} - -func (x *AddItem) GetItemId() uint32 { - if x != nil { - return x.ItemId - } - return 0 -} - -func (x *AddItem) GetQuantity() int32 { - if x != nil { - return x.Quantity - } - return 0 -} - -func (x *AddItem) GetPrice() int64 { - if x != nil { - return x.Price - } - return 0 -} - -func (x *AddItem) GetOrgPrice() int64 { - if x != nil { - return x.OrgPrice - } - return 0 -} - -func (x *AddItem) GetSku() string { - if x != nil { - return x.Sku - } - return "" -} - -func (x *AddItem) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *AddItem) GetImage() string { - if x != nil { - return x.Image - } - return "" -} - -func (x *AddItem) GetStock() int32 { - if x != nil { - return x.Stock - } - return 0 -} - -func (x *AddItem) GetTax() int32 { - if x != nil { - return x.Tax - } - return 0 -} - -func (x *AddItem) GetBrand() string { - if x != nil { - return x.Brand - } - return "" -} - -func (x *AddItem) GetCategory() string { - if x != nil { - return x.Category - } - return "" -} - -func (x *AddItem) GetCategory2() string { - if x != nil { - return x.Category2 - } - return "" -} - -func (x *AddItem) GetCategory3() string { - if x != nil { - return x.Category3 - } - return "" -} - -func (x *AddItem) GetCategory4() string { - if x != nil { - return x.Category4 - } - return "" -} - -func (x *AddItem) GetCategory5() string { - if x != nil { - return x.Category5 - } - return "" -} - -func (x *AddItem) GetDisclaimer() string { - if x != nil { - return x.Disclaimer - } - return "" -} - -func (x *AddItem) GetArticleType() string { - if x != nil { - return x.ArticleType - } - return "" -} - -func (x *AddItem) GetSellerId() string { - if x != nil { - return x.SellerId - } - return "" -} - -func (x *AddItem) GetSellerName() string { - if x != nil { - return x.SellerName - } - return "" -} - -func (x *AddItem) GetCountry() string { - if x != nil { - return x.Country - } - return "" -} - -func (x *AddItem) GetSaleStatus() string { - if x != nil { - return x.SaleStatus - } - return "" -} - -func (x *AddItem) GetOutlet() string { - if x != nil && x.Outlet != nil { - return *x.Outlet - } - return "" -} - -func (x *AddItem) GetStoreId() string { - if x != nil && x.StoreId != nil { - return *x.StoreId - } - return "" -} - -func (x *AddItem) GetParentId() uint32 { - if x != nil && x.ParentId != nil { - return *x.ParentId - } - return 0 -} - -func (x *AddItem) GetCgm() string { - if x != nil { - return x.Cgm - } - return "" -} - -func (x *AddItem) GetReservationEndTime() *timestamppb.Timestamp { - if x != nil { - return x.ReservationEndTime - } - return nil -} - -type RemoveItem struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id uint32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RemoveItem) Reset() { - *x = RemoveItem{} - mi := &file_messages_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RemoveItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveItem) ProtoMessage() {} - -func (x *RemoveItem) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveItem.ProtoReflect.Descriptor instead. -func (*RemoveItem) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{2} -} - -func (x *RemoveItem) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -type ChangeQuantity struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id uint32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` - Quantity int32 `protobuf:"varint,2,opt,name=quantity,proto3" json:"quantity,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ChangeQuantity) Reset() { - *x = ChangeQuantity{} - mi := &file_messages_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ChangeQuantity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChangeQuantity) ProtoMessage() {} - -func (x *ChangeQuantity) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChangeQuantity.ProtoReflect.Descriptor instead. -func (*ChangeQuantity) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{3} -} - -func (x *ChangeQuantity) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *ChangeQuantity) GetQuantity() int32 { - if x != nil { - return x.Quantity - } - return 0 -} - -type SetDelivery struct { - state protoimpl.MessageState `protogen:"open.v1"` - Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` - Items []uint32 `protobuf:"varint,2,rep,packed,name=items,proto3" json:"items,omitempty"` - PickupPoint *PickupPoint `protobuf:"bytes,3,opt,name=pickupPoint,proto3,oneof" json:"pickupPoint,omitempty"` - Country string `protobuf:"bytes,4,opt,name=country,proto3" json:"country,omitempty"` - Zip string `protobuf:"bytes,5,opt,name=zip,proto3" json:"zip,omitempty"` - Address *string `protobuf:"bytes,6,opt,name=address,proto3,oneof" json:"address,omitempty"` - City *string `protobuf:"bytes,7,opt,name=city,proto3,oneof" json:"city,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SetDelivery) Reset() { - *x = SetDelivery{} - mi := &file_messages_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SetDelivery) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetDelivery) ProtoMessage() {} - -func (x *SetDelivery) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetDelivery.ProtoReflect.Descriptor instead. -func (*SetDelivery) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{4} -} - -func (x *SetDelivery) GetProvider() string { - if x != nil { - return x.Provider - } - return "" -} - -func (x *SetDelivery) GetItems() []uint32 { - if x != nil { - return x.Items - } - return nil -} - -func (x *SetDelivery) GetPickupPoint() *PickupPoint { - if x != nil { - return x.PickupPoint - } - return nil -} - -func (x *SetDelivery) GetCountry() string { - if x != nil { - return x.Country - } - return "" -} - -func (x *SetDelivery) GetZip() string { - if x != nil { - return x.Zip - } - return "" -} - -func (x *SetDelivery) GetAddress() string { - if x != nil && x.Address != nil { - return *x.Address - } - return "" -} - -func (x *SetDelivery) GetCity() string { - if x != nil && x.City != nil { - return *x.City - } - return "" -} - -type SetPickupPoint struct { - state protoimpl.MessageState `protogen:"open.v1"` - DeliveryId uint32 `protobuf:"varint,1,opt,name=deliveryId,proto3" json:"deliveryId,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - Name *string `protobuf:"bytes,3,opt,name=name,proto3,oneof" json:"name,omitempty"` - Address *string `protobuf:"bytes,4,opt,name=address,proto3,oneof" json:"address,omitempty"` - City *string `protobuf:"bytes,5,opt,name=city,proto3,oneof" json:"city,omitempty"` - Zip *string `protobuf:"bytes,6,opt,name=zip,proto3,oneof" json:"zip,omitempty"` - Country *string `protobuf:"bytes,7,opt,name=country,proto3,oneof" json:"country,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SetPickupPoint) Reset() { - *x = SetPickupPoint{} - mi := &file_messages_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SetPickupPoint) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetPickupPoint) ProtoMessage() {} - -func (x *SetPickupPoint) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetPickupPoint.ProtoReflect.Descriptor instead. -func (*SetPickupPoint) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{5} -} - -func (x *SetPickupPoint) GetDeliveryId() uint32 { - if x != nil { - return x.DeliveryId - } - return 0 -} - -func (x *SetPickupPoint) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *SetPickupPoint) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *SetPickupPoint) GetAddress() string { - if x != nil && x.Address != nil { - return *x.Address - } - return "" -} - -func (x *SetPickupPoint) GetCity() string { - if x != nil && x.City != nil { - return *x.City - } - return "" -} - -func (x *SetPickupPoint) GetZip() string { - if x != nil && x.Zip != nil { - return *x.Zip - } - return "" -} - -func (x *SetPickupPoint) GetCountry() string { - if x != nil && x.Country != nil { - return *x.Country - } - return "" -} - -type PickupPoint struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name *string `protobuf:"bytes,2,opt,name=name,proto3,oneof" json:"name,omitempty"` - Address *string `protobuf:"bytes,3,opt,name=address,proto3,oneof" json:"address,omitempty"` - City *string `protobuf:"bytes,4,opt,name=city,proto3,oneof" json:"city,omitempty"` - Zip *string `protobuf:"bytes,5,opt,name=zip,proto3,oneof" json:"zip,omitempty"` - Country *string `protobuf:"bytes,6,opt,name=country,proto3,oneof" json:"country,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *PickupPoint) Reset() { - *x = PickupPoint{} - mi := &file_messages_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PickupPoint) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PickupPoint) ProtoMessage() {} - -func (x *PickupPoint) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PickupPoint.ProtoReflect.Descriptor instead. -func (*PickupPoint) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{6} -} - -func (x *PickupPoint) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *PickupPoint) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *PickupPoint) GetAddress() string { - if x != nil && x.Address != nil { - return *x.Address - } - return "" -} - -func (x *PickupPoint) GetCity() string { - if x != nil && x.City != nil { - return *x.City - } - return "" -} - -func (x *PickupPoint) GetZip() string { - if x != nil && x.Zip != nil { - return *x.Zip - } - return "" -} - -func (x *PickupPoint) GetCountry() string { - if x != nil && x.Country != nil { - return *x.Country - } - return "" -} - -type RemoveDelivery struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RemoveDelivery) Reset() { - *x = RemoveDelivery{} - mi := &file_messages_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RemoveDelivery) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveDelivery) ProtoMessage() {} - -func (x *RemoveDelivery) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveDelivery.ProtoReflect.Descriptor instead. -func (*RemoveDelivery) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{7} -} - -func (x *RemoveDelivery) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -type SetUserId struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SetUserId) Reset() { - *x = SetUserId{} - mi := &file_messages_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SetUserId) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SetUserId) ProtoMessage() {} - -func (x *SetUserId) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SetUserId.ProtoReflect.Descriptor instead. -func (*SetUserId) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{8} -} - -func (x *SetUserId) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -type LineItemMarking struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Type uint32 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"` - Marking string `protobuf:"bytes,3,opt,name=marking,proto3" json:"marking,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LineItemMarking) Reset() { - *x = LineItemMarking{} - mi := &file_messages_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LineItemMarking) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LineItemMarking) ProtoMessage() {} - -func (x *LineItemMarking) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LineItemMarking.ProtoReflect.Descriptor instead. -func (*LineItemMarking) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{9} -} - -func (x *LineItemMarking) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *LineItemMarking) GetType() uint32 { - if x != nil { - return x.Type - } - return 0 -} - -func (x *LineItemMarking) GetMarking() string { - if x != nil { - return x.Marking - } - return "" -} - -type RemoveLineItemMarking struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RemoveLineItemMarking) Reset() { - *x = RemoveLineItemMarking{} - mi := &file_messages_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RemoveLineItemMarking) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveLineItemMarking) ProtoMessage() {} - -func (x *RemoveLineItemMarking) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveLineItemMarking.ProtoReflect.Descriptor instead. -func (*RemoveLineItemMarking) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{10} -} - -func (x *RemoveLineItemMarking) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -type SubscriptionAdded struct { - state protoimpl.MessageState `protogen:"open.v1"` - ItemId uint32 `protobuf:"varint,1,opt,name=itemId,proto3" json:"itemId,omitempty"` - DetailsId string `protobuf:"bytes,3,opt,name=detailsId,proto3" json:"detailsId,omitempty"` - OrderReference string `protobuf:"bytes,4,opt,name=orderReference,proto3" json:"orderReference,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubscriptionAdded) Reset() { - *x = SubscriptionAdded{} - mi := &file_messages_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubscriptionAdded) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubscriptionAdded) ProtoMessage() {} - -func (x *SubscriptionAdded) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubscriptionAdded.ProtoReflect.Descriptor instead. -func (*SubscriptionAdded) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{11} -} - -func (x *SubscriptionAdded) GetItemId() uint32 { - if x != nil { - return x.ItemId - } - return 0 -} - -func (x *SubscriptionAdded) GetDetailsId() string { - if x != nil { - return x.DetailsId - } - return "" -} - -func (x *SubscriptionAdded) GetOrderReference() string { - if x != nil { - return x.OrderReference - } - return "" -} - -type PaymentStarted struct { - state protoimpl.MessageState `protogen:"open.v1"` - PaymentId string `protobuf:"bytes,1,opt,name=paymentId,proto3" json:"paymentId,omitempty"` - Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - Amount int64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` - Currency string `protobuf:"bytes,4,opt,name=currency,proto3" json:"currency,omitempty"` - Provider string `protobuf:"bytes,5,opt,name=provider,proto3" json:"provider,omitempty"` - Method *string `protobuf:"bytes,6,opt,name=method,proto3,oneof" json:"method,omitempty"` - StartedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=startedAt,proto3,oneof" json:"startedAt,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *PaymentStarted) Reset() { - *x = PaymentStarted{} - mi := &file_messages_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PaymentStarted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PaymentStarted) ProtoMessage() {} - -func (x *PaymentStarted) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[12] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PaymentStarted.ProtoReflect.Descriptor instead. -func (*PaymentStarted) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{12} -} - -func (x *PaymentStarted) GetPaymentId() string { - if x != nil { - return x.PaymentId - } - return "" -} - -func (x *PaymentStarted) GetVersion() uint32 { - if x != nil { - return x.Version - } - return 0 -} - -func (x *PaymentStarted) GetAmount() int64 { - if x != nil { - return x.Amount - } - return 0 -} - -func (x *PaymentStarted) GetCurrency() string { - if x != nil { - return x.Currency - } - return "" -} - -func (x *PaymentStarted) GetProvider() string { - if x != nil { - return x.Provider - } - return "" -} - -func (x *PaymentStarted) GetMethod() string { - if x != nil && x.Method != nil { - return *x.Method - } - return "" -} - -func (x *PaymentStarted) GetStartedAt() *timestamppb.Timestamp { - if x != nil { - return x.StartedAt - } - return nil -} - -type PaymentCompleted struct { - state protoimpl.MessageState `protogen:"open.v1"` - PaymentId string `protobuf:"bytes,1,opt,name=paymentId,proto3" json:"paymentId,omitempty"` - Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` - Amount int64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` - Currency string `protobuf:"bytes,4,opt,name=currency,proto3" json:"currency,omitempty"` - ProcessorReference *string `protobuf:"bytes,5,opt,name=processorReference,proto3,oneof" json:"processorReference,omitempty"` - CompletedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=completedAt,proto3,oneof" json:"completedAt,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *PaymentCompleted) Reset() { - *x = PaymentCompleted{} - mi := &file_messages_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PaymentCompleted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PaymentCompleted) ProtoMessage() {} - -func (x *PaymentCompleted) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PaymentCompleted.ProtoReflect.Descriptor instead. -func (*PaymentCompleted) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{13} -} - -func (x *PaymentCompleted) GetPaymentId() string { - if x != nil { - return x.PaymentId - } - return "" -} - -func (x *PaymentCompleted) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *PaymentCompleted) GetAmount() int64 { - if x != nil { - return x.Amount - } - return 0 -} - -func (x *PaymentCompleted) GetCurrency() string { - if x != nil { - return x.Currency - } - return "" -} - -func (x *PaymentCompleted) GetProcessorReference() string { - if x != nil && x.ProcessorReference != nil { - return *x.ProcessorReference - } - return "" -} - -func (x *PaymentCompleted) GetCompletedAt() *timestamppb.Timestamp { - if x != nil { - return x.CompletedAt - } - return nil -} - -type PaymentDeclined struct { - state protoimpl.MessageState `protogen:"open.v1"` - PaymentId string `protobuf:"bytes,1,opt,name=paymentId,proto3" json:"paymentId,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - Code *string `protobuf:"bytes,3,opt,name=code,proto3,oneof" json:"code,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *PaymentDeclined) Reset() { - *x = PaymentDeclined{} - mi := &file_messages_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PaymentDeclined) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PaymentDeclined) ProtoMessage() {} - -func (x *PaymentDeclined) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[14] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PaymentDeclined.ProtoReflect.Descriptor instead. -func (*PaymentDeclined) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{14} -} - -func (x *PaymentDeclined) GetPaymentId() string { - if x != nil { - return x.PaymentId - } - return "" -} - -func (x *PaymentDeclined) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *PaymentDeclined) GetCode() string { - if x != nil && x.Code != nil { - return *x.Code - } - return "" -} - -type PaymentEvent struct { - state protoimpl.MessageState `protogen:"open.v1"` - PaymentId string `protobuf:"bytes,1,opt,name=paymentId,proto3" json:"paymentId,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"` - Data *anypb.Any `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *PaymentEvent) Reset() { - *x = PaymentEvent{} - mi := &file_messages_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PaymentEvent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PaymentEvent) ProtoMessage() {} - -func (x *PaymentEvent) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[15] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PaymentEvent.ProtoReflect.Descriptor instead. -func (*PaymentEvent) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{15} -} - -func (x *PaymentEvent) GetPaymentId() string { - if x != nil { - return x.PaymentId - } - return "" -} - -func (x *PaymentEvent) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PaymentEvent) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *PaymentEvent) GetData() *anypb.Any { - if x != nil { - return x.Data - } - return nil -} - -type ConfirmationViewed struct { - state protoimpl.MessageState `protogen:"open.v1"` - ViewedAt *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=viewedAt,proto3" json:"viewedAt,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ConfirmationViewed) Reset() { - *x = ConfirmationViewed{} - mi := &file_messages_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ConfirmationViewed) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConfirmationViewed) ProtoMessage() {} - -func (x *ConfirmationViewed) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[16] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ConfirmationViewed.ProtoReflect.Descriptor instead. -func (*ConfirmationViewed) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{16} -} - -func (x *ConfirmationViewed) GetViewedAt() *timestamppb.Timestamp { - if x != nil { - return x.ViewedAt - } - return nil -} - -type CreateCheckoutOrder struct { - state protoimpl.MessageState `protogen:"open.v1"` - Terms string `protobuf:"bytes,1,opt,name=terms,proto3" json:"terms,omitempty"` - Checkout string `protobuf:"bytes,2,opt,name=checkout,proto3" json:"checkout,omitempty"` - Confirmation string `protobuf:"bytes,3,opt,name=confirmation,proto3" json:"confirmation,omitempty"` - Push string `protobuf:"bytes,4,opt,name=push,proto3" json:"push,omitempty"` - Validation string `protobuf:"bytes,5,opt,name=validation,proto3" json:"validation,omitempty"` - Country string `protobuf:"bytes,6,opt,name=country,proto3" json:"country,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateCheckoutOrder) Reset() { - *x = CreateCheckoutOrder{} - mi := &file_messages_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateCheckoutOrder) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateCheckoutOrder) ProtoMessage() {} - -func (x *CreateCheckoutOrder) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[17] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateCheckoutOrder.ProtoReflect.Descriptor instead. -func (*CreateCheckoutOrder) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{17} -} - -func (x *CreateCheckoutOrder) GetTerms() string { - if x != nil { - return x.Terms - } - return "" -} - -func (x *CreateCheckoutOrder) GetCheckout() string { - if x != nil { - return x.Checkout - } - return "" -} - -func (x *CreateCheckoutOrder) GetConfirmation() string { - if x != nil { - return x.Confirmation - } - return "" -} - -func (x *CreateCheckoutOrder) GetPush() string { - if x != nil { - return x.Push - } - return "" -} - -func (x *CreateCheckoutOrder) GetValidation() string { - if x != nil { - return x.Validation - } - return "" -} - -func (x *CreateCheckoutOrder) GetCountry() string { - if x != nil { - return x.Country - } - return "" -} - -type OrderCreated struct { - state protoimpl.MessageState `protogen:"open.v1"` - OrderId string `protobuf:"bytes,1,opt,name=orderId,proto3" json:"orderId,omitempty"` - Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *OrderCreated) Reset() { - *x = OrderCreated{} - mi := &file_messages_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *OrderCreated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OrderCreated) ProtoMessage() {} - -func (x *OrderCreated) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[18] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OrderCreated.ProtoReflect.Descriptor instead. -func (*OrderCreated) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{18} -} - -func (x *OrderCreated) GetOrderId() string { - if x != nil { - return x.OrderId - } - return "" -} - -func (x *OrderCreated) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -type Noop struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Noop) Reset() { - *x = Noop{} - mi := &file_messages_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Noop) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Noop) ProtoMessage() {} - -func (x *Noop) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[19] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Noop.ProtoReflect.Descriptor instead. -func (*Noop) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{19} -} - -type InitializeCheckout struct { - state protoimpl.MessageState `protogen:"open.v1"` - OrderId string `protobuf:"bytes,1,opt,name=orderId,proto3" json:"orderId,omitempty"` - Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` - PaymentInProgress bool `protobuf:"varint,3,opt,name=paymentInProgress,proto3" json:"paymentInProgress,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InitializeCheckout) Reset() { - *x = InitializeCheckout{} - mi := &file_messages_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InitializeCheckout) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitializeCheckout) ProtoMessage() {} - -func (x *InitializeCheckout) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[20] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitializeCheckout.ProtoReflect.Descriptor instead. -func (*InitializeCheckout) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{20} -} - -func (x *InitializeCheckout) GetOrderId() string { - if x != nil { - return x.OrderId - } - return "" -} - -func (x *InitializeCheckout) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *InitializeCheckout) GetPaymentInProgress() bool { - if x != nil { - return x.PaymentInProgress - } - return false -} - -type InventoryReserved struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` - Message *string `protobuf:"bytes,3,opt,name=message,proto3,oneof" json:"message,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InventoryReserved) Reset() { - *x = InventoryReserved{} - mi := &file_messages_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InventoryReserved) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InventoryReserved) ProtoMessage() {} - -func (x *InventoryReserved) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InventoryReserved.ProtoReflect.Descriptor instead. -func (*InventoryReserved) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{21} -} - -func (x *InventoryReserved) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *InventoryReserved) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *InventoryReserved) GetMessage() string { - if x != nil && x.Message != nil { - return *x.Message - } - return "" -} - -type AddVoucher struct { - state protoimpl.MessageState `protogen:"open.v1"` - Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` - Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` - VoucherRules []string `protobuf:"bytes,3,rep,name=voucherRules,proto3" json:"voucherRules,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AddVoucher) Reset() { - *x = AddVoucher{} - mi := &file_messages_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AddVoucher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddVoucher) ProtoMessage() {} - -func (x *AddVoucher) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[22] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddVoucher.ProtoReflect.Descriptor instead. -func (*AddVoucher) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{22} -} - -func (x *AddVoucher) GetCode() string { - if x != nil { - return x.Code - } - return "" -} - -func (x *AddVoucher) GetValue() int64 { - if x != nil { - return x.Value - } - return 0 -} - -func (x *AddVoucher) GetVoucherRules() []string { - if x != nil { - return x.VoucherRules - } - return nil -} - -func (x *AddVoucher) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -type RemoveVoucher struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RemoveVoucher) Reset() { - *x = RemoveVoucher{} - mi := &file_messages_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RemoveVoucher) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveVoucher) ProtoMessage() {} - -func (x *RemoveVoucher) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[23] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveVoucher.ProtoReflect.Descriptor instead. -func (*RemoveVoucher) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{23} -} - -func (x *RemoveVoucher) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -type UpsertSubscriptionDetails struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id *string `protobuf:"bytes,1,opt,name=id,proto3,oneof" json:"id,omitempty"` - OfferingCode string `protobuf:"bytes,2,opt,name=offeringCode,proto3" json:"offeringCode,omitempty"` - SigningType string `protobuf:"bytes,3,opt,name=signingType,proto3" json:"signingType,omitempty"` - Data *anypb.Any `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UpsertSubscriptionDetails) Reset() { - *x = UpsertSubscriptionDetails{} - mi := &file_messages_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UpsertSubscriptionDetails) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpsertSubscriptionDetails) ProtoMessage() {} - -func (x *UpsertSubscriptionDetails) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[24] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpsertSubscriptionDetails.ProtoReflect.Descriptor instead. -func (*UpsertSubscriptionDetails) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{24} -} - -func (x *UpsertSubscriptionDetails) GetId() string { - if x != nil && x.Id != nil { - return *x.Id - } - return "" -} - -func (x *UpsertSubscriptionDetails) GetOfferingCode() string { - if x != nil { - return x.OfferingCode - } - return "" -} - -func (x *UpsertSubscriptionDetails) GetSigningType() string { - if x != nil { - return x.SigningType - } - return "" -} - -func (x *UpsertSubscriptionDetails) GetData() *anypb.Any { - if x != nil { - return x.Data - } - return nil -} - -type PreConditionFailed struct { - state protoimpl.MessageState `protogen:"open.v1"` - Operation string `protobuf:"bytes,1,opt,name=operation,proto3" json:"operation,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` - Input *anypb.Any `protobuf:"bytes,3,opt,name=input,proto3" json:"input,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *PreConditionFailed) Reset() { - *x = PreConditionFailed{} - mi := &file_messages_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PreConditionFailed) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PreConditionFailed) ProtoMessage() {} - -func (x *PreConditionFailed) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[25] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PreConditionFailed.ProtoReflect.Descriptor instead. -func (*PreConditionFailed) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{25} -} - -func (x *PreConditionFailed) GetOperation() string { - if x != nil { - return x.Operation - } - return "" -} - -func (x *PreConditionFailed) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -func (x *PreConditionFailed) GetInput() *anypb.Any { - if x != nil { - return x.Input - } - return nil -} - -type GiftcardItem struct { - state protoimpl.MessageState `protogen:"open.v1"` - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - DeliveryDate string `protobuf:"bytes,2,opt,name=deliveryDate,proto3" json:"deliveryDate,omitempty"` - Recipient string `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"` - RecipientType string `protobuf:"bytes,4,opt,name=recipientType,proto3" json:"recipientType,omitempty"` - Message string `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` - DesignConfig *anypb.Any `protobuf:"bytes,6,opt,name=designConfig,proto3,oneof" json:"designConfig,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GiftcardItem) Reset() { - *x = GiftcardItem{} - mi := &file_messages_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GiftcardItem) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GiftcardItem) ProtoMessage() {} - -func (x *GiftcardItem) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[26] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GiftcardItem.ProtoReflect.Descriptor instead. -func (*GiftcardItem) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{26} -} - -func (x *GiftcardItem) GetValue() int64 { - if x != nil { - return x.Value - } - return 0 -} - -func (x *GiftcardItem) GetDeliveryDate() string { - if x != nil { - return x.DeliveryDate - } - return "" -} - -func (x *GiftcardItem) GetRecipient() string { - if x != nil { - return x.Recipient - } - return "" -} - -func (x *GiftcardItem) GetRecipientType() string { - if x != nil { - return x.RecipientType - } - return "" -} - -func (x *GiftcardItem) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *GiftcardItem) GetDesignConfig() *anypb.Any { - if x != nil { - return x.DesignConfig - } - return nil -} - -type AddGiftcard struct { - state protoimpl.MessageState `protogen:"open.v1"` - Giftcard *GiftcardItem `protobuf:"bytes,1,opt,name=giftcard,proto3" json:"giftcard,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AddGiftcard) Reset() { - *x = AddGiftcard{} - mi := &file_messages_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AddGiftcard) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddGiftcard) ProtoMessage() {} - -func (x *AddGiftcard) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[27] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddGiftcard.ProtoReflect.Descriptor instead. -func (*AddGiftcard) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{27} -} - -func (x *AddGiftcard) GetGiftcard() *GiftcardItem { - if x != nil { - return x.Giftcard - } - return nil -} - -type RemoveGiftcard struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RemoveGiftcard) Reset() { - *x = RemoveGiftcard{} - mi := &file_messages_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RemoveGiftcard) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveGiftcard) ProtoMessage() {} - -func (x *RemoveGiftcard) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[28] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveGiftcard.ProtoReflect.Descriptor instead. -func (*RemoveGiftcard) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{28} -} - -func (x *RemoveGiftcard) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -type Mutation struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to Type: - // - // *Mutation_ClearCart - // *Mutation_AddItem - // *Mutation_RemoveItem - // *Mutation_ChangeQuantity - // *Mutation_SetDelivery - // *Mutation_SetPickupPoint - // *Mutation_RemoveDelivery - // *Mutation_SetUserId - // *Mutation_LineItemMarking - // *Mutation_RemoveLineItemMarking - // *Mutation_SubscriptionAdded - // *Mutation_PaymentDeclined - // *Mutation_ConfirmationViewed - // *Mutation_CreateCheckoutOrder - // *Mutation_OrderCreated - // *Mutation_Noop - // *Mutation_InitializeCheckout - // *Mutation_InventoryReserved - // *Mutation_AddVoucher - // *Mutation_RemoveVoucher - // *Mutation_UpsertSubscriptionDetails - // *Mutation_PreConditionFailed - // *Mutation_AddGiftcard - // *Mutation_RemoveGiftcard - // *Mutation_PaymentStarted - // *Mutation_PaymentCompleted - // *Mutation_PaymentEvent - Type isMutation_Type `protobuf_oneof:"type"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Mutation) Reset() { - *x = Mutation{} - mi := &file_messages_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Mutation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Mutation) ProtoMessage() {} - -func (x *Mutation) ProtoReflect() protoreflect.Message { - mi := &file_messages_proto_msgTypes[29] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Mutation.ProtoReflect.Descriptor instead. -func (*Mutation) Descriptor() ([]byte, []int) { - return file_messages_proto_rawDescGZIP(), []int{29} -} - -func (x *Mutation) GetType() isMutation_Type { - if x != nil { - return x.Type - } - return nil -} - -func (x *Mutation) GetClearCart() *ClearCartRequest { - if x != nil { - if x, ok := x.Type.(*Mutation_ClearCart); ok { - return x.ClearCart - } - } - return nil -} - -func (x *Mutation) GetAddItem() *AddItem { - if x != nil { - if x, ok := x.Type.(*Mutation_AddItem); ok { - return x.AddItem - } - } - return nil -} - -func (x *Mutation) GetRemoveItem() *RemoveItem { - if x != nil { - if x, ok := x.Type.(*Mutation_RemoveItem); ok { - return x.RemoveItem - } - } - return nil -} - -func (x *Mutation) GetChangeQuantity() *ChangeQuantity { - if x != nil { - if x, ok := x.Type.(*Mutation_ChangeQuantity); ok { - return x.ChangeQuantity - } - } - return nil -} - -func (x *Mutation) GetSetDelivery() *SetDelivery { - if x != nil { - if x, ok := x.Type.(*Mutation_SetDelivery); ok { - return x.SetDelivery - } - } - return nil -} - -func (x *Mutation) GetSetPickupPoint() *SetPickupPoint { - if x != nil { - if x, ok := x.Type.(*Mutation_SetPickupPoint); ok { - return x.SetPickupPoint - } - } - return nil -} - -func (x *Mutation) GetRemoveDelivery() *RemoveDelivery { - if x != nil { - if x, ok := x.Type.(*Mutation_RemoveDelivery); ok { - return x.RemoveDelivery - } - } - return nil -} - -func (x *Mutation) GetSetUserId() *SetUserId { - if x != nil { - if x, ok := x.Type.(*Mutation_SetUserId); ok { - return x.SetUserId - } - } - return nil -} - -func (x *Mutation) GetLineItemMarking() *LineItemMarking { - if x != nil { - if x, ok := x.Type.(*Mutation_LineItemMarking); ok { - return x.LineItemMarking - } - } - return nil -} - -func (x *Mutation) GetRemoveLineItemMarking() *RemoveLineItemMarking { - if x != nil { - if x, ok := x.Type.(*Mutation_RemoveLineItemMarking); ok { - return x.RemoveLineItemMarking - } - } - return nil -} - -func (x *Mutation) GetSubscriptionAdded() *SubscriptionAdded { - if x != nil { - if x, ok := x.Type.(*Mutation_SubscriptionAdded); ok { - return x.SubscriptionAdded - } - } - return nil -} - -func (x *Mutation) GetPaymentDeclined() *PaymentDeclined { - if x != nil { - if x, ok := x.Type.(*Mutation_PaymentDeclined); ok { - return x.PaymentDeclined - } - } - return nil -} - -func (x *Mutation) GetConfirmationViewed() *ConfirmationViewed { - if x != nil { - if x, ok := x.Type.(*Mutation_ConfirmationViewed); ok { - return x.ConfirmationViewed - } - } - return nil -} - -func (x *Mutation) GetCreateCheckoutOrder() *CreateCheckoutOrder { - if x != nil { - if x, ok := x.Type.(*Mutation_CreateCheckoutOrder); ok { - return x.CreateCheckoutOrder - } - } - return nil -} - -func (x *Mutation) GetOrderCreated() *OrderCreated { - if x != nil { - if x, ok := x.Type.(*Mutation_OrderCreated); ok { - return x.OrderCreated - } - } - return nil -} - -func (x *Mutation) GetNoop() *Noop { - if x != nil { - if x, ok := x.Type.(*Mutation_Noop); ok { - return x.Noop - } - } - return nil -} - -func (x *Mutation) GetInitializeCheckout() *InitializeCheckout { - if x != nil { - if x, ok := x.Type.(*Mutation_InitializeCheckout); ok { - return x.InitializeCheckout - } - } - return nil -} - -func (x *Mutation) GetInventoryReserved() *InventoryReserved { - if x != nil { - if x, ok := x.Type.(*Mutation_InventoryReserved); ok { - return x.InventoryReserved - } - } - return nil -} - -func (x *Mutation) GetAddVoucher() *AddVoucher { - if x != nil { - if x, ok := x.Type.(*Mutation_AddVoucher); ok { - return x.AddVoucher - } - } - return nil -} - -func (x *Mutation) GetRemoveVoucher() *RemoveVoucher { - if x != nil { - if x, ok := x.Type.(*Mutation_RemoveVoucher); ok { - return x.RemoveVoucher - } - } - return nil -} - -func (x *Mutation) GetUpsertSubscriptionDetails() *UpsertSubscriptionDetails { - if x != nil { - if x, ok := x.Type.(*Mutation_UpsertSubscriptionDetails); ok { - return x.UpsertSubscriptionDetails - } - } - return nil -} - -func (x *Mutation) GetPreConditionFailed() *PreConditionFailed { - if x != nil { - if x, ok := x.Type.(*Mutation_PreConditionFailed); ok { - return x.PreConditionFailed - } - } - return nil -} - -func (x *Mutation) GetAddGiftcard() *AddGiftcard { - if x != nil { - if x, ok := x.Type.(*Mutation_AddGiftcard); ok { - return x.AddGiftcard - } - } - return nil -} - -func (x *Mutation) GetRemoveGiftcard() *RemoveGiftcard { - if x != nil { - if x, ok := x.Type.(*Mutation_RemoveGiftcard); ok { - return x.RemoveGiftcard - } - } - return nil -} - -func (x *Mutation) GetPaymentStarted() *PaymentStarted { - if x != nil { - if x, ok := x.Type.(*Mutation_PaymentStarted); ok { - return x.PaymentStarted - } - } - return nil -} - -func (x *Mutation) GetPaymentCompleted() *PaymentCompleted { - if x != nil { - if x, ok := x.Type.(*Mutation_PaymentCompleted); ok { - return x.PaymentCompleted - } - } - return nil -} - -func (x *Mutation) GetPaymentEvent() *PaymentEvent { - if x != nil { - if x, ok := x.Type.(*Mutation_PaymentEvent); ok { - return x.PaymentEvent - } - } - return nil -} - -type isMutation_Type interface { - isMutation_Type() -} - -type Mutation_ClearCart struct { - ClearCart *ClearCartRequest `protobuf:"bytes,1,opt,name=clear_cart,json=clearCart,proto3,oneof"` -} - -type Mutation_AddItem struct { - AddItem *AddItem `protobuf:"bytes,2,opt,name=add_item,json=addItem,proto3,oneof"` -} - -type Mutation_RemoveItem struct { - RemoveItem *RemoveItem `protobuf:"bytes,3,opt,name=remove_item,json=removeItem,proto3,oneof"` -} - -type Mutation_ChangeQuantity struct { - ChangeQuantity *ChangeQuantity `protobuf:"bytes,4,opt,name=change_quantity,json=changeQuantity,proto3,oneof"` -} - -type Mutation_SetDelivery struct { - SetDelivery *SetDelivery `protobuf:"bytes,5,opt,name=set_delivery,json=setDelivery,proto3,oneof"` -} - -type Mutation_SetPickupPoint struct { - SetPickupPoint *SetPickupPoint `protobuf:"bytes,6,opt,name=set_pickup_point,json=setPickupPoint,proto3,oneof"` -} - -type Mutation_RemoveDelivery struct { - RemoveDelivery *RemoveDelivery `protobuf:"bytes,7,opt,name=remove_delivery,json=removeDelivery,proto3,oneof"` -} - -type Mutation_SetUserId struct { - SetUserId *SetUserId `protobuf:"bytes,8,opt,name=set_user_id,json=setUserId,proto3,oneof"` -} - -type Mutation_LineItemMarking struct { - LineItemMarking *LineItemMarking `protobuf:"bytes,9,opt,name=line_item_marking,json=lineItemMarking,proto3,oneof"` -} - -type Mutation_RemoveLineItemMarking struct { - RemoveLineItemMarking *RemoveLineItemMarking `protobuf:"bytes,10,opt,name=remove_line_item_marking,json=removeLineItemMarking,proto3,oneof"` -} - -type Mutation_SubscriptionAdded struct { - SubscriptionAdded *SubscriptionAdded `protobuf:"bytes,11,opt,name=subscription_added,json=subscriptionAdded,proto3,oneof"` -} - -type Mutation_PaymentDeclined struct { - PaymentDeclined *PaymentDeclined `protobuf:"bytes,12,opt,name=payment_declined,json=paymentDeclined,proto3,oneof"` -} - -type Mutation_ConfirmationViewed struct { - ConfirmationViewed *ConfirmationViewed `protobuf:"bytes,13,opt,name=confirmation_viewed,json=confirmationViewed,proto3,oneof"` -} - -type Mutation_CreateCheckoutOrder struct { - CreateCheckoutOrder *CreateCheckoutOrder `protobuf:"bytes,14,opt,name=create_checkout_order,json=createCheckoutOrder,proto3,oneof"` -} - -type Mutation_OrderCreated struct { - OrderCreated *OrderCreated `protobuf:"bytes,15,opt,name=order_created,json=orderCreated,proto3,oneof"` -} - -type Mutation_Noop struct { - Noop *Noop `protobuf:"bytes,16,opt,name=noop,proto3,oneof"` -} - -type Mutation_InitializeCheckout struct { - InitializeCheckout *InitializeCheckout `protobuf:"bytes,17,opt,name=initialize_checkout,json=initializeCheckout,proto3,oneof"` -} - -type Mutation_InventoryReserved struct { - InventoryReserved *InventoryReserved `protobuf:"bytes,18,opt,name=inventory_reserved,json=inventoryReserved,proto3,oneof"` -} - -type Mutation_AddVoucher struct { - AddVoucher *AddVoucher `protobuf:"bytes,19,opt,name=add_voucher,json=addVoucher,proto3,oneof"` -} - -type Mutation_RemoveVoucher struct { - RemoveVoucher *RemoveVoucher `protobuf:"bytes,20,opt,name=remove_voucher,json=removeVoucher,proto3,oneof"` -} - -type Mutation_UpsertSubscriptionDetails struct { - UpsertSubscriptionDetails *UpsertSubscriptionDetails `protobuf:"bytes,21,opt,name=upsert_subscription_details,json=upsertSubscriptionDetails,proto3,oneof"` -} - -type Mutation_PreConditionFailed struct { - PreConditionFailed *PreConditionFailed `protobuf:"bytes,22,opt,name=pre_condition_failed,json=preConditionFailed,proto3,oneof"` -} - -type Mutation_AddGiftcard struct { - AddGiftcard *AddGiftcard `protobuf:"bytes,23,opt,name=add_giftcard,json=addGiftcard,proto3,oneof"` -} - -type Mutation_RemoveGiftcard struct { - RemoveGiftcard *RemoveGiftcard `protobuf:"bytes,24,opt,name=remove_giftcard,json=removeGiftcard,proto3,oneof"` -} - -type Mutation_PaymentStarted struct { - PaymentStarted *PaymentStarted `protobuf:"bytes,25,opt,name=payment_started,json=paymentStarted,proto3,oneof"` -} - -type Mutation_PaymentCompleted struct { - PaymentCompleted *PaymentCompleted `protobuf:"bytes,26,opt,name=payment_completed,json=paymentCompleted,proto3,oneof"` -} - -type Mutation_PaymentEvent struct { - PaymentEvent *PaymentEvent `protobuf:"bytes,27,opt,name=payment_event,json=paymentEvent,proto3,oneof"` -} - -func (*Mutation_ClearCart) isMutation_Type() {} - -func (*Mutation_AddItem) isMutation_Type() {} - -func (*Mutation_RemoveItem) isMutation_Type() {} - -func (*Mutation_ChangeQuantity) isMutation_Type() {} - -func (*Mutation_SetDelivery) isMutation_Type() {} - -func (*Mutation_SetPickupPoint) isMutation_Type() {} - -func (*Mutation_RemoveDelivery) isMutation_Type() {} - -func (*Mutation_SetUserId) isMutation_Type() {} - -func (*Mutation_LineItemMarking) isMutation_Type() {} - -func (*Mutation_RemoveLineItemMarking) isMutation_Type() {} - -func (*Mutation_SubscriptionAdded) isMutation_Type() {} - -func (*Mutation_PaymentDeclined) isMutation_Type() {} - -func (*Mutation_ConfirmationViewed) isMutation_Type() {} - -func (*Mutation_CreateCheckoutOrder) isMutation_Type() {} - -func (*Mutation_OrderCreated) isMutation_Type() {} - -func (*Mutation_Noop) isMutation_Type() {} - -func (*Mutation_InitializeCheckout) isMutation_Type() {} - -func (*Mutation_InventoryReserved) isMutation_Type() {} - -func (*Mutation_AddVoucher) isMutation_Type() {} - -func (*Mutation_RemoveVoucher) isMutation_Type() {} - -func (*Mutation_UpsertSubscriptionDetails) isMutation_Type() {} - -func (*Mutation_PreConditionFailed) isMutation_Type() {} - -func (*Mutation_AddGiftcard) isMutation_Type() {} - -func (*Mutation_RemoveGiftcard) isMutation_Type() {} - -func (*Mutation_PaymentStarted) isMutation_Type() {} - -func (*Mutation_PaymentCompleted) isMutation_Type() {} - -func (*Mutation_PaymentEvent) isMutation_Type() {} - -var File_messages_proto protoreflect.FileDescriptor - -var file_messages_proto_rawDesc = string([]byte{ - 0x0a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x12, 0x0a, 0x10, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, - 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xb1, 0x06, 0x0a, 0x07, 0x41, - 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x74, 0x65, 0x6d, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x69, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, - 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x70, - 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x67, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x67, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x10, 0x0a, - 0x03, 0x73, 0x6b, 0x75, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x6b, 0x75, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x6f, - 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x12, - 0x10, 0x0a, 0x03, 0x74, 0x61, 0x78, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x74, 0x61, - 0x78, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, - 0x6f, 0x72, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, - 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x32, - 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, - 0x32, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x33, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x33, 0x12, - 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x34, 0x18, 0x11, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x34, 0x12, 0x1c, 0x0a, - 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x35, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x35, 0x12, 0x1e, 0x0a, 0x0a, 0x64, - 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x61, - 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x49, 0x64, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x6c, - 0x6c, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, - 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x72, 0x79, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x61, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x61, 0x6c, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x6c, 0x65, 0x74, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x6c, 0x65, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x1d, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x49, 0x64, 0x18, 0x16, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x01, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, - 0x1f, 0x0a, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, - 0x12, 0x10, 0x0a, 0x03, 0x63, 0x67, 0x6d, 0x18, 0x19, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, - 0x67, 0x6d, 0x12, 0x4f, 0x0a, 0x12, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x48, 0x03, 0x52, 0x12, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, - 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x75, 0x74, 0x6c, 0x65, 0x74, 0x42, 0x0a, - 0x0a, 0x08, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x49, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x70, - 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x1c, - 0x0a, 0x0a, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, - 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x49, 0x64, 0x22, 0x3c, 0x0a, 0x0e, - 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x0e, - 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1a, - 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x22, 0x86, 0x02, 0x0a, 0x0b, 0x53, - 0x65, 0x74, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x3c, 0x0a, 0x0b, - 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x69, 0x63, - 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x69, 0x63, 0x6b, - 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x7a, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x7a, 0x69, 0x70, 0x12, 0x1d, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x04, 0x63, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x0e, - 0x0a, 0x0c, 0x5f, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x42, 0x0a, - 0x0a, 0x08, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x63, - 0x69, 0x74, 0x79, 0x22, 0xf9, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x50, 0x69, 0x63, 0x6b, 0x75, - 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, - 0x72, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x65, 0x6c, 0x69, - 0x76, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x1d, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x88, 0x01, 0x01, 0x12, 0x17, - 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x04, - 0x63, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x7a, 0x69, 0x70, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x03, 0x7a, 0x69, 0x70, 0x88, 0x01, 0x01, 0x12, 0x1d, - 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x04, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x63, 0x69, 0x74, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x5f, - 0x7a, 0x69, 0x70, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x22, - 0xd6, 0x01, 0x0a, 0x0b, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x04, 0x63, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, - 0x12, 0x15, 0x0a, 0x03, 0x7a, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, - 0x03, 0x7a, 0x69, 0x70, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x72, 0x79, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, - 0x0a, 0x0a, 0x08, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x63, 0x69, 0x74, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x7a, 0x69, 0x70, 0x42, 0x0a, 0x0a, 0x08, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x20, 0x0a, 0x0e, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0x23, 0x0a, 0x09, 0x53, 0x65, - 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, - 0x4f, 0x0a, 0x0f, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, - 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x69, 0x6e, - 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, - 0x22, 0x27, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x74, - 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0x71, 0x0a, 0x11, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x16, - 0x0a, 0x06, 0x69, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, - 0x69, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x73, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x73, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, - 0x64, 0x65, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x8d, 0x02, 0x0a, - 0x0e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, - 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x88, 0x01, 0x01, 0x12, 0x3d, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, - 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x48, 0x01, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x42, 0x0c, - 0x0a, 0x0a, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x9b, 0x02, 0x0a, - 0x10, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x33, 0x0a, 0x12, 0x70, - 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, - 0x73, 0x73, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x41, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x48, 0x01, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x88, 0x01, 0x01, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x6f, - 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x63, - 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x6b, 0x0a, 0x0f, 0x50, 0x61, - 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x1c, 0x0a, - 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x42, 0x07, - 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x84, 0x01, 0x0a, 0x0c, 0x50, 0x61, 0x79, 0x6d, - 0x65, 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x79, 0x6d, - 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x4c, - 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x69, - 0x65, 0x77, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x08, 0x76, 0x69, 0x65, 0x77, 0x65, 0x64, 0x41, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x08, 0x76, 0x69, 0x65, 0x77, 0x65, 0x64, 0x41, 0x74, 0x22, 0xb9, 0x01, 0x0a, - 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x4f, - 0x72, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, - 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x75, - 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x75, 0x73, 0x68, 0x12, 0x1e, - 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, - 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x40, 0x0a, 0x0c, 0x4f, 0x72, 0x64, 0x65, - 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, - 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, - 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x06, 0x0a, 0x04, 0x4e, 0x6f, - 0x6f, 0x70, 0x22, 0x74, 0x0a, 0x12, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, - 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, - 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x70, 0x61, - 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x6e, - 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x22, 0x66, 0x0a, 0x11, 0x49, 0x6e, 0x76, 0x65, - 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x22, 0x7c, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x56, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x12, 0x12, - 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, - 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x76, 0x6f, 0x75, 0x63, - 0x68, 0x65, 0x72, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, - 0x76, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x1f, - 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, - 0xa7, 0x01, 0x0a, 0x19, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x13, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x88, - 0x01, 0x01, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x6f, - 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x69, - 0x6e, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, - 0x67, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x69, 0x67, - 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x69, 0x64, 0x22, 0x74, 0x0a, 0x12, 0x50, 0x72, 0x65, - 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, - 0x1c, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x22, - 0xf6, 0x01, 0x0a, 0x0c, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, - 0x72, 0x79, 0x44, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, - 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, - 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, - 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x72, 0x65, 0x63, 0x69, - 0x70, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0d, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x64, 0x65, 0x73, 0x69, - 0x67, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, 0x0c, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x64, 0x65, 0x73, 0x69, - 0x67, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x41, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x47, - 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x12, 0x32, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, 0x63, - 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x2e, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x49, 0x74, 0x65, - 0x6d, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x22, 0x20, 0x0a, 0x0e, 0x52, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0xe4, 0x0e, - 0x0a, 0x08, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x0a, 0x63, 0x6c, - 0x65, 0x61, 0x72, 0x5f, 0x63, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, - 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, - 0x65, 0x61, 0x72, 0x43, 0x61, 0x72, 0x74, 0x12, 0x2e, 0x0a, 0x08, 0x61, 0x64, 0x64, 0x5f, 0x69, - 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x00, 0x52, 0x07, - 0x61, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x37, 0x0a, 0x0b, 0x72, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x74, - 0x65, 0x6d, 0x48, 0x00, 0x52, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x74, 0x65, 0x6d, - 0x12, 0x43, 0x0a, 0x0f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x61, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x61, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x3a, 0x0a, 0x0c, 0x73, 0x65, 0x74, 0x5f, 0x64, 0x65, 0x6c, - 0x69, 0x76, 0x65, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, - 0x72, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x65, 0x74, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, - 0x79, 0x12, 0x44, 0x0a, 0x10, 0x73, 0x65, 0x74, 0x5f, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x5f, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, - 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x65, 0x74, 0x50, 0x69, 0x63, 0x6b, - 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0e, 0x72, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, 0x35, 0x0a, 0x0b, - 0x73, 0x65, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x53, 0x65, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x48, 0x00, 0x52, 0x09, 0x73, 0x65, 0x74, 0x55, 0x73, 0x65, - 0x72, 0x49, 0x64, 0x12, 0x47, 0x0a, 0x11, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, - 0x5f, 0x6d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x74, - 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x0f, 0x6c, 0x69, 0x6e, - 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x5a, 0x0a, 0x18, - 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, - 0x5f, 0x6d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, - 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x48, - 0x00, 0x52, 0x15, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x74, 0x65, - 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x4c, 0x0a, 0x12, 0x73, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x65, 0x64, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x65, - 0x64, 0x48, 0x00, 0x52, 0x11, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, - 0x74, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x79, 0x6d, - 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x70, - 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x4f, - 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, - 0x69, 0x65, 0x77, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x56, 0x69, 0x65, 0x77, 0x65, 0x64, 0x48, 0x00, 0x52, 0x12, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x69, 0x65, 0x77, 0x65, 0x64, 0x12, - 0x53, 0x0a, 0x15, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, - 0x75, 0x74, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, - 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, - 0x13, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x4f, - 0x72, 0x64, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0d, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0c, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x64, 0x12, 0x24, 0x0a, 0x04, 0x6e, 0x6f, 0x6f, 0x70, 0x18, 0x10, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4e, 0x6f, 0x6f, - 0x70, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x6f, 0x6f, 0x70, 0x12, 0x4f, 0x0a, 0x13, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, - 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x6f, 0x75, 0x74, 0x48, 0x00, 0x52, 0x12, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, - 0x7a, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x12, 0x4c, 0x0a, 0x12, 0x69, 0x6e, - 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x2e, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x48, 0x00, 0x52, 0x11, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x5f, - 0x76, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x56, 0x6f, 0x75, 0x63, - 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x64, 0x64, 0x56, 0x6f, 0x75, 0x63, 0x68, 0x65, - 0x72, 0x12, 0x40, 0x0a, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x76, 0x6f, 0x75, 0x63, - 0x68, 0x65, 0x72, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x75, 0x63, 0x68, - 0x65, 0x72, 0x48, 0x00, 0x52, 0x0d, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x75, 0x63, - 0x68, 0x65, 0x72, 0x12, 0x65, 0x0a, 0x1b, 0x75, 0x70, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x73, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x48, 0x00, 0x52, - 0x19, 0x75, 0x70, 0x73, 0x65, 0x72, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x50, 0x0a, 0x14, 0x70, 0x72, - 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x61, 0x69, 0x6c, - 0x65, 0x64, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x2e, 0x50, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x48, 0x00, 0x52, 0x12, 0x70, 0x72, 0x65, 0x43, 0x6f, 0x6e, - 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x3a, 0x0a, 0x0c, - 0x61, 0x64, 0x64, 0x5f, 0x67, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x18, 0x17, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x64, 0x64, - 0x47, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x12, 0x43, 0x0a, 0x0f, 0x72, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x5f, 0x67, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x18, 0x18, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0e, 0x72, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x47, 0x69, 0x66, 0x74, 0x63, 0x61, 0x72, 0x64, 0x12, 0x43, 0x0a, - 0x0f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, - 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, - 0x48, 0x00, 0x52, 0x0e, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x65, 0x64, 0x12, 0x49, 0x0a, 0x11, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x6f, - 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, - 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x10, 0x70, 0x61, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x3d, 0x0a, - 0x0d, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x1b, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, - 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0c, - 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x06, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x2e, 0x6b, 0x36, 0x6e, 0x2e, - 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x61, 0x72, 0x74, 0x2d, 0x61, 0x63, 0x74, 0x6f, - 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -}) - -var ( - file_messages_proto_rawDescOnce sync.Once - file_messages_proto_rawDescData []byte -) - -func file_messages_proto_rawDescGZIP() []byte { - file_messages_proto_rawDescOnce.Do(func() { - file_messages_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_messages_proto_rawDesc), len(file_messages_proto_rawDesc))) - }) - return file_messages_proto_rawDescData -} - -var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 30) -var file_messages_proto_goTypes = []any{ - (*ClearCartRequest)(nil), // 0: messages.ClearCartRequest - (*AddItem)(nil), // 1: messages.AddItem - (*RemoveItem)(nil), // 2: messages.RemoveItem - (*ChangeQuantity)(nil), // 3: messages.ChangeQuantity - (*SetDelivery)(nil), // 4: messages.SetDelivery - (*SetPickupPoint)(nil), // 5: messages.SetPickupPoint - (*PickupPoint)(nil), // 6: messages.PickupPoint - (*RemoveDelivery)(nil), // 7: messages.RemoveDelivery - (*SetUserId)(nil), // 8: messages.SetUserId - (*LineItemMarking)(nil), // 9: messages.LineItemMarking - (*RemoveLineItemMarking)(nil), // 10: messages.RemoveLineItemMarking - (*SubscriptionAdded)(nil), // 11: messages.SubscriptionAdded - (*PaymentStarted)(nil), // 12: messages.PaymentStarted - (*PaymentCompleted)(nil), // 13: messages.PaymentCompleted - (*PaymentDeclined)(nil), // 14: messages.PaymentDeclined - (*PaymentEvent)(nil), // 15: messages.PaymentEvent - (*ConfirmationViewed)(nil), // 16: messages.ConfirmationViewed - (*CreateCheckoutOrder)(nil), // 17: messages.CreateCheckoutOrder - (*OrderCreated)(nil), // 18: messages.OrderCreated - (*Noop)(nil), // 19: messages.Noop - (*InitializeCheckout)(nil), // 20: messages.InitializeCheckout - (*InventoryReserved)(nil), // 21: messages.InventoryReserved - (*AddVoucher)(nil), // 22: messages.AddVoucher - (*RemoveVoucher)(nil), // 23: messages.RemoveVoucher - (*UpsertSubscriptionDetails)(nil), // 24: messages.UpsertSubscriptionDetails - (*PreConditionFailed)(nil), // 25: messages.PreConditionFailed - (*GiftcardItem)(nil), // 26: messages.GiftcardItem - (*AddGiftcard)(nil), // 27: messages.AddGiftcard - (*RemoveGiftcard)(nil), // 28: messages.RemoveGiftcard - (*Mutation)(nil), // 29: messages.Mutation - (*timestamppb.Timestamp)(nil), // 30: google.protobuf.Timestamp - (*anypb.Any)(nil), // 31: google.protobuf.Any -} -var file_messages_proto_depIdxs = []int32{ - 30, // 0: messages.AddItem.reservationEndTime:type_name -> google.protobuf.Timestamp - 6, // 1: messages.SetDelivery.pickupPoint:type_name -> messages.PickupPoint - 30, // 2: messages.PaymentStarted.startedAt:type_name -> google.protobuf.Timestamp - 30, // 3: messages.PaymentCompleted.completedAt:type_name -> google.protobuf.Timestamp - 31, // 4: messages.PaymentEvent.data:type_name -> google.protobuf.Any - 30, // 5: messages.ConfirmationViewed.viewedAt:type_name -> google.protobuf.Timestamp - 31, // 6: messages.UpsertSubscriptionDetails.data:type_name -> google.protobuf.Any - 31, // 7: messages.PreConditionFailed.input:type_name -> google.protobuf.Any - 31, // 8: messages.GiftcardItem.designConfig:type_name -> google.protobuf.Any - 26, // 9: messages.AddGiftcard.giftcard:type_name -> messages.GiftcardItem - 0, // 10: messages.Mutation.clear_cart:type_name -> messages.ClearCartRequest - 1, // 11: messages.Mutation.add_item:type_name -> messages.AddItem - 2, // 12: messages.Mutation.remove_item:type_name -> messages.RemoveItem - 3, // 13: messages.Mutation.change_quantity:type_name -> messages.ChangeQuantity - 4, // 14: messages.Mutation.set_delivery:type_name -> messages.SetDelivery - 5, // 15: messages.Mutation.set_pickup_point:type_name -> messages.SetPickupPoint - 7, // 16: messages.Mutation.remove_delivery:type_name -> messages.RemoveDelivery - 8, // 17: messages.Mutation.set_user_id:type_name -> messages.SetUserId - 9, // 18: messages.Mutation.line_item_marking:type_name -> messages.LineItemMarking - 10, // 19: messages.Mutation.remove_line_item_marking:type_name -> messages.RemoveLineItemMarking - 11, // 20: messages.Mutation.subscription_added:type_name -> messages.SubscriptionAdded - 14, // 21: messages.Mutation.payment_declined:type_name -> messages.PaymentDeclined - 16, // 22: messages.Mutation.confirmation_viewed:type_name -> messages.ConfirmationViewed - 17, // 23: messages.Mutation.create_checkout_order:type_name -> messages.CreateCheckoutOrder - 18, // 24: messages.Mutation.order_created:type_name -> messages.OrderCreated - 19, // 25: messages.Mutation.noop:type_name -> messages.Noop - 20, // 26: messages.Mutation.initialize_checkout:type_name -> messages.InitializeCheckout - 21, // 27: messages.Mutation.inventory_reserved:type_name -> messages.InventoryReserved - 22, // 28: messages.Mutation.add_voucher:type_name -> messages.AddVoucher - 23, // 29: messages.Mutation.remove_voucher:type_name -> messages.RemoveVoucher - 24, // 30: messages.Mutation.upsert_subscription_details:type_name -> messages.UpsertSubscriptionDetails - 25, // 31: messages.Mutation.pre_condition_failed:type_name -> messages.PreConditionFailed - 27, // 32: messages.Mutation.add_giftcard:type_name -> messages.AddGiftcard - 28, // 33: messages.Mutation.remove_giftcard:type_name -> messages.RemoveGiftcard - 12, // 34: messages.Mutation.payment_started:type_name -> messages.PaymentStarted - 13, // 35: messages.Mutation.payment_completed:type_name -> messages.PaymentCompleted - 15, // 36: messages.Mutation.payment_event:type_name -> messages.PaymentEvent - 37, // [37:37] is the sub-list for method output_type - 37, // [37:37] is the sub-list for method input_type - 37, // [37:37] is the sub-list for extension type_name - 37, // [37:37] is the sub-list for extension extendee - 0, // [0:37] is the sub-list for field type_name -} - -func init() { file_messages_proto_init() } -func file_messages_proto_init() { - if File_messages_proto != nil { - return - } - file_messages_proto_msgTypes[1].OneofWrappers = []any{} - file_messages_proto_msgTypes[4].OneofWrappers = []any{} - file_messages_proto_msgTypes[5].OneofWrappers = []any{} - file_messages_proto_msgTypes[6].OneofWrappers = []any{} - file_messages_proto_msgTypes[12].OneofWrappers = []any{} - file_messages_proto_msgTypes[13].OneofWrappers = []any{} - file_messages_proto_msgTypes[14].OneofWrappers = []any{} - file_messages_proto_msgTypes[21].OneofWrappers = []any{} - file_messages_proto_msgTypes[24].OneofWrappers = []any{} - file_messages_proto_msgTypes[26].OneofWrappers = []any{} - file_messages_proto_msgTypes[29].OneofWrappers = []any{ - (*Mutation_ClearCart)(nil), - (*Mutation_AddItem)(nil), - (*Mutation_RemoveItem)(nil), - (*Mutation_ChangeQuantity)(nil), - (*Mutation_SetDelivery)(nil), - (*Mutation_SetPickupPoint)(nil), - (*Mutation_RemoveDelivery)(nil), - (*Mutation_SetUserId)(nil), - (*Mutation_LineItemMarking)(nil), - (*Mutation_RemoveLineItemMarking)(nil), - (*Mutation_SubscriptionAdded)(nil), - (*Mutation_PaymentDeclined)(nil), - (*Mutation_ConfirmationViewed)(nil), - (*Mutation_CreateCheckoutOrder)(nil), - (*Mutation_OrderCreated)(nil), - (*Mutation_Noop)(nil), - (*Mutation_InitializeCheckout)(nil), - (*Mutation_InventoryReserved)(nil), - (*Mutation_AddVoucher)(nil), - (*Mutation_RemoveVoucher)(nil), - (*Mutation_UpsertSubscriptionDetails)(nil), - (*Mutation_PreConditionFailed)(nil), - (*Mutation_AddGiftcard)(nil), - (*Mutation_RemoveGiftcard)(nil), - (*Mutation_PaymentStarted)(nil), - (*Mutation_PaymentCompleted)(nil), - (*Mutation_PaymentEvent)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_messages_proto_rawDesc), len(file_messages_proto_rawDesc)), - NumEnums: 0, - NumMessages: 30, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_messages_proto_goTypes, - DependencyIndexes: file_messages_proto_depIdxs, - MessageInfos: file_messages_proto_msgTypes, - }.Build() - File_messages_proto = out.File - file_messages_proto_goTypes = nil - file_messages_proto_depIdxs = nil -} diff --git a/pkg/proxy/remotehost.go b/pkg/proxy/remotehost.go index 550f906..206e279 100644 --- a/pkg/proxy/remotehost.go +++ b/pkg/proxy/remotehost.go @@ -11,7 +11,7 @@ import ( "net/http" "time" - "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/control" "go.opentelemetry.io/contrib/bridges/otelslog" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" diff --git a/pkg/voucher/service.go b/pkg/voucher/service.go index 342a716..03b599f 100644 --- a/pkg/voucher/service.go +++ b/pkg/voucher/service.go @@ -6,7 +6,7 @@ import ( "fmt" "os" - "git.k6n.net/go-cart-actor/pkg/messages" + messages "git.k6n.net/go-cart-actor/proto/cart" ) type Rule struct { diff --git a/proto/cart.proto b/proto/cart.proto new file mode 100644 index 0000000..685255e --- /dev/null +++ b/proto/cart.proto @@ -0,0 +1,96 @@ +syntax = "proto3"; +package cart_messages; +option go_package = "git.k6n.net/go-cart-actor/proto/cart;cart_messages"; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +message ClearCartRequest {} + +message AddItem { + uint32 item_id = 1; + int32 quantity = 2; + int64 price = 3; + int64 orgPrice = 9; + string sku = 4; + string name = 5; + string image = 6; + int32 stock = 7; + int32 tax = 8; + string brand = 13; + string category = 14; + string category2 = 15; + string category3 = 16; + string category4 = 17; + string category5 = 18; + string disclaimer = 10; + string articleType = 11; + string sellerId = 19; + string sellerName = 20; + string country = 21; + string saleStatus = 24; + optional string outlet = 12; + optional string storeId = 22; + optional uint32 parentId = 23; + string cgm = 25; + optional google.protobuf.Timestamp reservationEndTime = 26; +} + +message RemoveItem { uint32 Id = 1; } + +message ChangeQuantity { + uint32 Id = 1; + int32 quantity = 2; +} + +message SetUserId { + string userId = 1; +} + +message LineItemMarking { + uint32 id = 1; + uint32 type = 2; + string marking = 3; +} + +message RemoveLineItemMarking { + uint32 id = 1; +} + +message SubscriptionAdded { + uint32 itemId = 1; + string detailsId = 3; + string orderReference = 4; +} + +message AddVoucher { + string code = 1; + int64 value = 2; + repeated string voucherRules = 3; + string description = 4; +} + +message RemoveVoucher { uint32 id = 1; } + +message UpsertSubscriptionDetails { + optional string id = 1; + string offeringCode = 2; + string signingType = 3; + google.protobuf.Any data = 4; +} + +message Mutation { + oneof type { + ClearCartRequest clear_cart = 1; + AddItem add_item = 2; + RemoveItem remove_item = 3; + ChangeQuantity change_quantity = 4; + SetUserId set_user_id = 5; + LineItemMarking line_item_marking = 6; + RemoveLineItemMarking remove_line_item_marking = 7; + SubscriptionAdded subscription_added = 8; + AddVoucher add_voucher = 20; + RemoveVoucher remove_voucher = 21; + UpsertSubscriptionDetails upsert_subscription_details = 22; + } +} diff --git a/proto/cart/cart.pb.go b/proto/cart/cart.pb.go new file mode 100644 index 0000000..06ef266 --- /dev/null +++ b/proto/cart/cart.pb.go @@ -0,0 +1,1266 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.5 +// protoc v6.33.1 +// source: cart.proto + +package cart_messages + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ClearCartRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClearCartRequest) Reset() { + *x = ClearCartRequest{} + mi := &file_cart_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClearCartRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearCartRequest) ProtoMessage() {} + +func (x *ClearCartRequest) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClearCartRequest.ProtoReflect.Descriptor instead. +func (*ClearCartRequest) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{0} +} + +type AddItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + ItemId uint32 `protobuf:"varint,1,opt,name=item_id,json=itemId,proto3" json:"item_id,omitempty"` + Quantity int32 `protobuf:"varint,2,opt,name=quantity,proto3" json:"quantity,omitempty"` + Price int64 `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"` + OrgPrice int64 `protobuf:"varint,9,opt,name=orgPrice,proto3" json:"orgPrice,omitempty"` + Sku string `protobuf:"bytes,4,opt,name=sku,proto3" json:"sku,omitempty"` + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` + Image string `protobuf:"bytes,6,opt,name=image,proto3" json:"image,omitempty"` + Stock int32 `protobuf:"varint,7,opt,name=stock,proto3" json:"stock,omitempty"` + Tax int32 `protobuf:"varint,8,opt,name=tax,proto3" json:"tax,omitempty"` + Brand string `protobuf:"bytes,13,opt,name=brand,proto3" json:"brand,omitempty"` + Category string `protobuf:"bytes,14,opt,name=category,proto3" json:"category,omitempty"` + Category2 string `protobuf:"bytes,15,opt,name=category2,proto3" json:"category2,omitempty"` + Category3 string `protobuf:"bytes,16,opt,name=category3,proto3" json:"category3,omitempty"` + Category4 string `protobuf:"bytes,17,opt,name=category4,proto3" json:"category4,omitempty"` + Category5 string `protobuf:"bytes,18,opt,name=category5,proto3" json:"category5,omitempty"` + Disclaimer string `protobuf:"bytes,10,opt,name=disclaimer,proto3" json:"disclaimer,omitempty"` + ArticleType string `protobuf:"bytes,11,opt,name=articleType,proto3" json:"articleType,omitempty"` + SellerId string `protobuf:"bytes,19,opt,name=sellerId,proto3" json:"sellerId,omitempty"` + SellerName string `protobuf:"bytes,20,opt,name=sellerName,proto3" json:"sellerName,omitempty"` + Country string `protobuf:"bytes,21,opt,name=country,proto3" json:"country,omitempty"` + SaleStatus string `protobuf:"bytes,24,opt,name=saleStatus,proto3" json:"saleStatus,omitempty"` + Outlet *string `protobuf:"bytes,12,opt,name=outlet,proto3,oneof" json:"outlet,omitempty"` + StoreId *string `protobuf:"bytes,22,opt,name=storeId,proto3,oneof" json:"storeId,omitempty"` + ParentId *uint32 `protobuf:"varint,23,opt,name=parentId,proto3,oneof" json:"parentId,omitempty"` + Cgm string `protobuf:"bytes,25,opt,name=cgm,proto3" json:"cgm,omitempty"` + ReservationEndTime *timestamppb.Timestamp `protobuf:"bytes,26,opt,name=reservationEndTime,proto3,oneof" json:"reservationEndTime,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddItem) Reset() { + *x = AddItem{} + mi := &file_cart_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddItem) ProtoMessage() {} + +func (x *AddItem) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddItem.ProtoReflect.Descriptor instead. +func (*AddItem) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{1} +} + +func (x *AddItem) GetItemId() uint32 { + if x != nil { + return x.ItemId + } + return 0 +} + +func (x *AddItem) GetQuantity() int32 { + if x != nil { + return x.Quantity + } + return 0 +} + +func (x *AddItem) GetPrice() int64 { + if x != nil { + return x.Price + } + return 0 +} + +func (x *AddItem) GetOrgPrice() int64 { + if x != nil { + return x.OrgPrice + } + return 0 +} + +func (x *AddItem) GetSku() string { + if x != nil { + return x.Sku + } + return "" +} + +func (x *AddItem) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *AddItem) GetImage() string { + if x != nil { + return x.Image + } + return "" +} + +func (x *AddItem) GetStock() int32 { + if x != nil { + return x.Stock + } + return 0 +} + +func (x *AddItem) GetTax() int32 { + if x != nil { + return x.Tax + } + return 0 +} + +func (x *AddItem) GetBrand() string { + if x != nil { + return x.Brand + } + return "" +} + +func (x *AddItem) GetCategory() string { + if x != nil { + return x.Category + } + return "" +} + +func (x *AddItem) GetCategory2() string { + if x != nil { + return x.Category2 + } + return "" +} + +func (x *AddItem) GetCategory3() string { + if x != nil { + return x.Category3 + } + return "" +} + +func (x *AddItem) GetCategory4() string { + if x != nil { + return x.Category4 + } + return "" +} + +func (x *AddItem) GetCategory5() string { + if x != nil { + return x.Category5 + } + return "" +} + +func (x *AddItem) GetDisclaimer() string { + if x != nil { + return x.Disclaimer + } + return "" +} + +func (x *AddItem) GetArticleType() string { + if x != nil { + return x.ArticleType + } + return "" +} + +func (x *AddItem) GetSellerId() string { + if x != nil { + return x.SellerId + } + return "" +} + +func (x *AddItem) GetSellerName() string { + if x != nil { + return x.SellerName + } + return "" +} + +func (x *AddItem) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + +func (x *AddItem) GetSaleStatus() string { + if x != nil { + return x.SaleStatus + } + return "" +} + +func (x *AddItem) GetOutlet() string { + if x != nil && x.Outlet != nil { + return *x.Outlet + } + return "" +} + +func (x *AddItem) GetStoreId() string { + if x != nil && x.StoreId != nil { + return *x.StoreId + } + return "" +} + +func (x *AddItem) GetParentId() uint32 { + if x != nil && x.ParentId != nil { + return *x.ParentId + } + return 0 +} + +func (x *AddItem) GetCgm() string { + if x != nil { + return x.Cgm + } + return "" +} + +func (x *AddItem) GetReservationEndTime() *timestamppb.Timestamp { + if x != nil { + return x.ReservationEndTime + } + return nil +} + +type RemoveItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveItem) Reset() { + *x = RemoveItem{} + mi := &file_cart_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveItem) ProtoMessage() {} + +func (x *RemoveItem) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveItem.ProtoReflect.Descriptor instead. +func (*RemoveItem) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{2} +} + +func (x *RemoveItem) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +type ChangeQuantity struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` + Quantity int32 `protobuf:"varint,2,opt,name=quantity,proto3" json:"quantity,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChangeQuantity) Reset() { + *x = ChangeQuantity{} + mi := &file_cart_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChangeQuantity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChangeQuantity) ProtoMessage() {} + +func (x *ChangeQuantity) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChangeQuantity.ProtoReflect.Descriptor instead. +func (*ChangeQuantity) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{3} +} + +func (x *ChangeQuantity) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ChangeQuantity) GetQuantity() int32 { + if x != nil { + return x.Quantity + } + return 0 +} + +type SetUserId struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetUserId) Reset() { + *x = SetUserId{} + mi := &file_cart_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetUserId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetUserId) ProtoMessage() {} + +func (x *SetUserId) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetUserId.ProtoReflect.Descriptor instead. +func (*SetUserId) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{4} +} + +func (x *SetUserId) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type LineItemMarking struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Type uint32 `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"` + Marking string `protobuf:"bytes,3,opt,name=marking,proto3" json:"marking,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LineItemMarking) Reset() { + *x = LineItemMarking{} + mi := &file_cart_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LineItemMarking) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LineItemMarking) ProtoMessage() {} + +func (x *LineItemMarking) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LineItemMarking.ProtoReflect.Descriptor instead. +func (*LineItemMarking) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{5} +} + +func (x *LineItemMarking) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *LineItemMarking) GetType() uint32 { + if x != nil { + return x.Type + } + return 0 +} + +func (x *LineItemMarking) GetMarking() string { + if x != nil { + return x.Marking + } + return "" +} + +type RemoveLineItemMarking struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveLineItemMarking) Reset() { + *x = RemoveLineItemMarking{} + mi := &file_cart_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveLineItemMarking) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveLineItemMarking) ProtoMessage() {} + +func (x *RemoveLineItemMarking) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveLineItemMarking.ProtoReflect.Descriptor instead. +func (*RemoveLineItemMarking) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{6} +} + +func (x *RemoveLineItemMarking) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +type SubscriptionAdded struct { + state protoimpl.MessageState `protogen:"open.v1"` + ItemId uint32 `protobuf:"varint,1,opt,name=itemId,proto3" json:"itemId,omitempty"` + DetailsId string `protobuf:"bytes,3,opt,name=detailsId,proto3" json:"detailsId,omitempty"` + OrderReference string `protobuf:"bytes,4,opt,name=orderReference,proto3" json:"orderReference,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SubscriptionAdded) Reset() { + *x = SubscriptionAdded{} + mi := &file_cart_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubscriptionAdded) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscriptionAdded) ProtoMessage() {} + +func (x *SubscriptionAdded) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscriptionAdded.ProtoReflect.Descriptor instead. +func (*SubscriptionAdded) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{7} +} + +func (x *SubscriptionAdded) GetItemId() uint32 { + if x != nil { + return x.ItemId + } + return 0 +} + +func (x *SubscriptionAdded) GetDetailsId() string { + if x != nil { + return x.DetailsId + } + return "" +} + +func (x *SubscriptionAdded) GetOrderReference() string { + if x != nil { + return x.OrderReference + } + return "" +} + +type AddVoucher struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` + VoucherRules []string `protobuf:"bytes,3,rep,name=voucherRules,proto3" json:"voucherRules,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddVoucher) Reset() { + *x = AddVoucher{} + mi := &file_cart_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddVoucher) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddVoucher) ProtoMessage() {} + +func (x *AddVoucher) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddVoucher.ProtoReflect.Descriptor instead. +func (*AddVoucher) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{8} +} + +func (x *AddVoucher) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *AddVoucher) GetValue() int64 { + if x != nil { + return x.Value + } + return 0 +} + +func (x *AddVoucher) GetVoucherRules() []string { + if x != nil { + return x.VoucherRules + } + return nil +} + +func (x *AddVoucher) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +type RemoveVoucher struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveVoucher) Reset() { + *x = RemoveVoucher{} + mi := &file_cart_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveVoucher) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveVoucher) ProtoMessage() {} + +func (x *RemoveVoucher) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveVoucher.ProtoReflect.Descriptor instead. +func (*RemoveVoucher) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{9} +} + +func (x *RemoveVoucher) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +type UpsertSubscriptionDetails struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id *string `protobuf:"bytes,1,opt,name=id,proto3,oneof" json:"id,omitempty"` + OfferingCode string `protobuf:"bytes,2,opt,name=offeringCode,proto3" json:"offeringCode,omitempty"` + SigningType string `protobuf:"bytes,3,opt,name=signingType,proto3" json:"signingType,omitempty"` + Data *anypb.Any `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpsertSubscriptionDetails) Reset() { + *x = UpsertSubscriptionDetails{} + mi := &file_cart_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpsertSubscriptionDetails) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpsertSubscriptionDetails) ProtoMessage() {} + +func (x *UpsertSubscriptionDetails) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpsertSubscriptionDetails.ProtoReflect.Descriptor instead. +func (*UpsertSubscriptionDetails) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{10} +} + +func (x *UpsertSubscriptionDetails) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +func (x *UpsertSubscriptionDetails) GetOfferingCode() string { + if x != nil { + return x.OfferingCode + } + return "" +} + +func (x *UpsertSubscriptionDetails) GetSigningType() string { + if x != nil { + return x.SigningType + } + return "" +} + +func (x *UpsertSubscriptionDetails) GetData() *anypb.Any { + if x != nil { + return x.Data + } + return nil +} + +type Mutation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Type: + // + // *Mutation_ClearCart + // *Mutation_AddItem + // *Mutation_RemoveItem + // *Mutation_ChangeQuantity + // *Mutation_SetUserId + // *Mutation_LineItemMarking + // *Mutation_RemoveLineItemMarking + // *Mutation_SubscriptionAdded + // *Mutation_AddVoucher + // *Mutation_RemoveVoucher + // *Mutation_UpsertSubscriptionDetails + Type isMutation_Type `protobuf_oneof:"type"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Mutation) Reset() { + *x = Mutation{} + mi := &file_cart_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Mutation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Mutation) ProtoMessage() {} + +func (x *Mutation) ProtoReflect() protoreflect.Message { + mi := &file_cart_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Mutation.ProtoReflect.Descriptor instead. +func (*Mutation) Descriptor() ([]byte, []int) { + return file_cart_proto_rawDescGZIP(), []int{11} +} + +func (x *Mutation) GetType() isMutation_Type { + if x != nil { + return x.Type + } + return nil +} + +func (x *Mutation) GetClearCart() *ClearCartRequest { + if x != nil { + if x, ok := x.Type.(*Mutation_ClearCart); ok { + return x.ClearCart + } + } + return nil +} + +func (x *Mutation) GetAddItem() *AddItem { + if x != nil { + if x, ok := x.Type.(*Mutation_AddItem); ok { + return x.AddItem + } + } + return nil +} + +func (x *Mutation) GetRemoveItem() *RemoveItem { + if x != nil { + if x, ok := x.Type.(*Mutation_RemoveItem); ok { + return x.RemoveItem + } + } + return nil +} + +func (x *Mutation) GetChangeQuantity() *ChangeQuantity { + if x != nil { + if x, ok := x.Type.(*Mutation_ChangeQuantity); ok { + return x.ChangeQuantity + } + } + return nil +} + +func (x *Mutation) GetSetUserId() *SetUserId { + if x != nil { + if x, ok := x.Type.(*Mutation_SetUserId); ok { + return x.SetUserId + } + } + return nil +} + +func (x *Mutation) GetLineItemMarking() *LineItemMarking { + if x != nil { + if x, ok := x.Type.(*Mutation_LineItemMarking); ok { + return x.LineItemMarking + } + } + return nil +} + +func (x *Mutation) GetRemoveLineItemMarking() *RemoveLineItemMarking { + if x != nil { + if x, ok := x.Type.(*Mutation_RemoveLineItemMarking); ok { + return x.RemoveLineItemMarking + } + } + return nil +} + +func (x *Mutation) GetSubscriptionAdded() *SubscriptionAdded { + if x != nil { + if x, ok := x.Type.(*Mutation_SubscriptionAdded); ok { + return x.SubscriptionAdded + } + } + return nil +} + +func (x *Mutation) GetAddVoucher() *AddVoucher { + if x != nil { + if x, ok := x.Type.(*Mutation_AddVoucher); ok { + return x.AddVoucher + } + } + return nil +} + +func (x *Mutation) GetRemoveVoucher() *RemoveVoucher { + if x != nil { + if x, ok := x.Type.(*Mutation_RemoveVoucher); ok { + return x.RemoveVoucher + } + } + return nil +} + +func (x *Mutation) GetUpsertSubscriptionDetails() *UpsertSubscriptionDetails { + if x != nil { + if x, ok := x.Type.(*Mutation_UpsertSubscriptionDetails); ok { + return x.UpsertSubscriptionDetails + } + } + return nil +} + +type isMutation_Type interface { + isMutation_Type() +} + +type Mutation_ClearCart struct { + ClearCart *ClearCartRequest `protobuf:"bytes,1,opt,name=clear_cart,json=clearCart,proto3,oneof"` +} + +type Mutation_AddItem struct { + AddItem *AddItem `protobuf:"bytes,2,opt,name=add_item,json=addItem,proto3,oneof"` +} + +type Mutation_RemoveItem struct { + RemoveItem *RemoveItem `protobuf:"bytes,3,opt,name=remove_item,json=removeItem,proto3,oneof"` +} + +type Mutation_ChangeQuantity struct { + ChangeQuantity *ChangeQuantity `protobuf:"bytes,4,opt,name=change_quantity,json=changeQuantity,proto3,oneof"` +} + +type Mutation_SetUserId struct { + SetUserId *SetUserId `protobuf:"bytes,5,opt,name=set_user_id,json=setUserId,proto3,oneof"` +} + +type Mutation_LineItemMarking struct { + LineItemMarking *LineItemMarking `protobuf:"bytes,6,opt,name=line_item_marking,json=lineItemMarking,proto3,oneof"` +} + +type Mutation_RemoveLineItemMarking struct { + RemoveLineItemMarking *RemoveLineItemMarking `protobuf:"bytes,7,opt,name=remove_line_item_marking,json=removeLineItemMarking,proto3,oneof"` +} + +type Mutation_SubscriptionAdded struct { + SubscriptionAdded *SubscriptionAdded `protobuf:"bytes,8,opt,name=subscription_added,json=subscriptionAdded,proto3,oneof"` +} + +type Mutation_AddVoucher struct { + AddVoucher *AddVoucher `protobuf:"bytes,20,opt,name=add_voucher,json=addVoucher,proto3,oneof"` +} + +type Mutation_RemoveVoucher struct { + RemoveVoucher *RemoveVoucher `protobuf:"bytes,21,opt,name=remove_voucher,json=removeVoucher,proto3,oneof"` +} + +type Mutation_UpsertSubscriptionDetails struct { + UpsertSubscriptionDetails *UpsertSubscriptionDetails `protobuf:"bytes,22,opt,name=upsert_subscription_details,json=upsertSubscriptionDetails,proto3,oneof"` +} + +func (*Mutation_ClearCart) isMutation_Type() {} + +func (*Mutation_AddItem) isMutation_Type() {} + +func (*Mutation_RemoveItem) isMutation_Type() {} + +func (*Mutation_ChangeQuantity) isMutation_Type() {} + +func (*Mutation_SetUserId) isMutation_Type() {} + +func (*Mutation_LineItemMarking) isMutation_Type() {} + +func (*Mutation_RemoveLineItemMarking) isMutation_Type() {} + +func (*Mutation_SubscriptionAdded) isMutation_Type() {} + +func (*Mutation_AddVoucher) isMutation_Type() {} + +func (*Mutation_RemoveVoucher) isMutation_Type() {} + +func (*Mutation_UpsertSubscriptionDetails) isMutation_Type() {} + +var File_cart_proto protoreflect.FileDescriptor + +var file_cart_proto_rawDesc = string([]byte{ + 0x0a, 0x0a, 0x63, 0x61, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x63, 0x61, + 0x72, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x1a, 0x19, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x12, 0x0a, 0x10, 0x43, 0x6c, 0x65, 0x61, 0x72, + 0x43, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xb1, 0x06, 0x0a, 0x07, + 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x74, 0x65, 0x6d, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x69, 0x74, 0x65, 0x6d, 0x49, 0x64, + 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, + 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x67, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x67, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x73, 0x6b, 0x75, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x6b, 0x75, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, + 0x6f, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x6f, 0x63, 0x6b, + 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x78, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x74, + 0x61, 0x78, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x74, 0x65, + 0x67, 0x6f, 0x72, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, 0x74, 0x65, + 0x67, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, + 0x32, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, + 0x79, 0x32, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x33, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x33, + 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x34, 0x18, 0x11, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x34, 0x12, 0x1c, + 0x0a, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x35, 0x18, 0x12, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x35, 0x12, 0x1e, 0x0a, 0x0a, + 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, + 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x49, 0x64, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, + 0x6c, 0x6c, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x73, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x61, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x61, 0x6c, 0x65, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x6c, 0x65, 0x74, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x6c, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x49, 0x64, 0x18, 0x16, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x01, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x49, 0x64, 0x88, 0x01, 0x01, + 0x12, 0x1f, 0x0a, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x17, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x08, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x88, 0x01, + 0x01, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x67, 0x6d, 0x18, 0x19, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x63, 0x67, 0x6d, 0x12, 0x4f, 0x0a, 0x12, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x48, 0x03, 0x52, 0x12, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x75, 0x74, 0x6c, 0x65, 0x74, 0x42, + 0x0a, 0x0a, 0x08, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x49, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, + 0x1c, 0x0a, 0x0a, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, + 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x49, 0x64, 0x22, 0x3c, 0x0a, + 0x0e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, + 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x49, 0x64, 0x12, + 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x22, 0x23, 0x0a, 0x09, 0x53, + 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x22, 0x4f, 0x0a, 0x0f, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, + 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x69, + 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x69, 0x6e, + 0x67, 0x22, 0x27, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x6e, 0x65, 0x49, + 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0x71, 0x0a, 0x11, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x69, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x06, 0x69, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x73, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, + 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x7c, 0x0a, + 0x0a, 0x41, 0x64, 0x64, 0x56, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x63, + 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x76, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, + 0x52, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x76, 0x6f, 0x75, + 0x63, 0x68, 0x65, 0x72, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x1f, 0x0a, 0x0d, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0xa7, 0x01, 0x0a, + 0x19, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x13, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x88, 0x01, 0x01, 0x12, + 0x22, 0x0a, 0x0c, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x43, + 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x79, + 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, + 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, + 0x05, 0x0a, 0x03, 0x5f, 0x69, 0x64, 0x22, 0xc0, 0x06, 0x0a, 0x08, 0x4d, 0x75, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x0a, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x61, 0x72, 0x74, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x61, 0x72, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x65, 0x61, + 0x72, 0x43, 0x61, 0x72, 0x74, 0x12, 0x33, 0x0a, 0x08, 0x61, 0x64, 0x64, 0x5f, 0x69, 0x74, 0x65, + 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x61, 0x72, 0x74, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48, + 0x00, 0x52, 0x07, 0x61, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x3c, 0x0a, 0x0b, 0x72, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x63, 0x61, 0x72, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x00, 0x52, 0x0a, 0x72, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x48, 0x0a, 0x0f, 0x63, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x5f, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x61, 0x72, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x48, 0x00, 0x52, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x12, 0x3a, 0x0a, 0x0b, 0x73, 0x65, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x61, 0x72, 0x74, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x48, 0x00, 0x52, 0x09, 0x73, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x4c, + 0x0a, 0x11, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x5f, 0x6d, 0x61, 0x72, 0x6b, + 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x61, 0x72, 0x74, + 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x74, + 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x0f, 0x6c, 0x69, 0x6e, + 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x5f, 0x0a, 0x18, + 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, + 0x5f, 0x6d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x63, 0x61, 0x72, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, + 0x6b, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x15, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, + 0x6e, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4d, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x51, 0x0a, + 0x12, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, + 0x64, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x61, 0x72, 0x74, + 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x65, 0x64, 0x48, 0x00, 0x52, 0x11, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x65, 0x64, + 0x12, 0x3c, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x5f, 0x76, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x61, 0x72, 0x74, 0x5f, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x56, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, + 0x48, 0x00, 0x52, 0x0a, 0x61, 0x64, 0x64, 0x56, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, 0x12, 0x45, + 0x0a, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x76, 0x6f, 0x75, 0x63, 0x68, 0x65, 0x72, + 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x61, 0x72, 0x74, 0x5f, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x6f, 0x75, + 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0d, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x6f, + 0x75, 0x63, 0x68, 0x65, 0x72, 0x12, 0x6a, 0x0a, 0x1b, 0x75, 0x70, 0x73, 0x65, 0x72, 0x74, 0x5f, + 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x73, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x61, 0x72, + 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, + 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x73, 0x48, 0x00, 0x52, 0x19, 0x75, 0x70, 0x73, 0x65, 0x72, 0x74, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x73, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, + 0x2e, 0x6b, 0x36, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x61, 0x72, 0x74, + 0x2d, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x61, 0x72, + 0x74, 0x3b, 0x63, 0x61, 0x72, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +}) + +var ( + file_cart_proto_rawDescOnce sync.Once + file_cart_proto_rawDescData []byte +) + +func file_cart_proto_rawDescGZIP() []byte { + file_cart_proto_rawDescOnce.Do(func() { + file_cart_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cart_proto_rawDesc), len(file_cart_proto_rawDesc))) + }) + return file_cart_proto_rawDescData +} + +var file_cart_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_cart_proto_goTypes = []any{ + (*ClearCartRequest)(nil), // 0: cart_messages.ClearCartRequest + (*AddItem)(nil), // 1: cart_messages.AddItem + (*RemoveItem)(nil), // 2: cart_messages.RemoveItem + (*ChangeQuantity)(nil), // 3: cart_messages.ChangeQuantity + (*SetUserId)(nil), // 4: cart_messages.SetUserId + (*LineItemMarking)(nil), // 5: cart_messages.LineItemMarking + (*RemoveLineItemMarking)(nil), // 6: cart_messages.RemoveLineItemMarking + (*SubscriptionAdded)(nil), // 7: cart_messages.SubscriptionAdded + (*AddVoucher)(nil), // 8: cart_messages.AddVoucher + (*RemoveVoucher)(nil), // 9: cart_messages.RemoveVoucher + (*UpsertSubscriptionDetails)(nil), // 10: cart_messages.UpsertSubscriptionDetails + (*Mutation)(nil), // 11: cart_messages.Mutation + (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp + (*anypb.Any)(nil), // 13: google.protobuf.Any +} +var file_cart_proto_depIdxs = []int32{ + 12, // 0: cart_messages.AddItem.reservationEndTime:type_name -> google.protobuf.Timestamp + 13, // 1: cart_messages.UpsertSubscriptionDetails.data:type_name -> google.protobuf.Any + 0, // 2: cart_messages.Mutation.clear_cart:type_name -> cart_messages.ClearCartRequest + 1, // 3: cart_messages.Mutation.add_item:type_name -> cart_messages.AddItem + 2, // 4: cart_messages.Mutation.remove_item:type_name -> cart_messages.RemoveItem + 3, // 5: cart_messages.Mutation.change_quantity:type_name -> cart_messages.ChangeQuantity + 4, // 6: cart_messages.Mutation.set_user_id:type_name -> cart_messages.SetUserId + 5, // 7: cart_messages.Mutation.line_item_marking:type_name -> cart_messages.LineItemMarking + 6, // 8: cart_messages.Mutation.remove_line_item_marking:type_name -> cart_messages.RemoveLineItemMarking + 7, // 9: cart_messages.Mutation.subscription_added:type_name -> cart_messages.SubscriptionAdded + 8, // 10: cart_messages.Mutation.add_voucher:type_name -> cart_messages.AddVoucher + 9, // 11: cart_messages.Mutation.remove_voucher:type_name -> cart_messages.RemoveVoucher + 10, // 12: cart_messages.Mutation.upsert_subscription_details:type_name -> cart_messages.UpsertSubscriptionDetails + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name +} + +func init() { file_cart_proto_init() } +func file_cart_proto_init() { + if File_cart_proto != nil { + return + } + file_cart_proto_msgTypes[1].OneofWrappers = []any{} + file_cart_proto_msgTypes[10].OneofWrappers = []any{} + file_cart_proto_msgTypes[11].OneofWrappers = []any{ + (*Mutation_ClearCart)(nil), + (*Mutation_AddItem)(nil), + (*Mutation_RemoveItem)(nil), + (*Mutation_ChangeQuantity)(nil), + (*Mutation_SetUserId)(nil), + (*Mutation_LineItemMarking)(nil), + (*Mutation_RemoveLineItemMarking)(nil), + (*Mutation_SubscriptionAdded)(nil), + (*Mutation_AddVoucher)(nil), + (*Mutation_RemoveVoucher)(nil), + (*Mutation_UpsertSubscriptionDetails)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_cart_proto_rawDesc), len(file_cart_proto_rawDesc)), + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cart_proto_goTypes, + DependencyIndexes: file_cart_proto_depIdxs, + MessageInfos: file_cart_proto_msgTypes, + }.Build() + File_cart_proto = out.File + file_cart_proto_goTypes = nil + file_cart_proto_depIdxs = nil +} diff --git a/proto/checkout.proto b/proto/checkout.proto new file mode 100644 index 0000000..48708ce --- /dev/null +++ b/proto/checkout.proto @@ -0,0 +1,106 @@ +syntax = "proto3"; +package checkout_messages; +option go_package = "git.k6n.net/go-cart-actor/proto/checkout;checkout_messages"; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +message SetDelivery { + string provider = 1; + repeated uint32 items = 2; + optional PickupPoint pickupPoint = 3; + string country = 4; + string zip = 5; + optional string address = 6; + optional string city = 7; +} + +message SetPickupPoint { + uint32 deliveryId = 1; + PickupPoint pickupPoint = 2; +} + +message PickupPoint { + string id = 2; + optional string name = 3; + optional string address = 4; + optional string city = 5; + optional string zip = 6; + optional string country = 7; +} + +message RemoveDelivery { uint32 id = 1; } + +message PaymentStarted { + string paymentId = 1; + int64 amount = 3; + string currency = 4; + string provider = 5; + optional string method = 6; + optional google.protobuf.Timestamp startedAt = 7; + repeated uint32 items = 2; +} + +message PaymentCompleted { + string paymentId = 1; + string status = 2; + int64 amount = 3; + string currency = 4; + optional string processorReference = 5; + optional google.protobuf.Timestamp completedAt = 6; +} + +message PaymentDeclined { + string paymentId = 1; + string message = 2; + optional string code = 3; +} + +message PaymentEvent { + string paymentId = 1; + string name = 2; + bool success = 3; + google.protobuf.Any data = 4; +} + +message ConfirmationViewed { + google.protobuf.Timestamp viewedAt = 1; +} + +message OrderCreated { + string orderId = 1; + string status = 2; + google.protobuf.Timestamp createdAt = 3; +} + +message InitializeCheckout { + string orderId = 1; + uint64 cartId = 2; + uint32 version = 3; + google.protobuf.Any cartState = 4; +} + +message InventoryReserved { + string id = 1; + string status = 2; + optional string message = 3; +} + +message Mutation { + oneof type { + SetDelivery set_delivery = 1; + SetPickupPoint set_pickup_point = 2; + RemoveDelivery remove_delivery = 3; + PaymentDeclined payment_declined = 4; + ConfirmationViewed confirmation_viewed = 5; + + OrderCreated order_created = 7; + + InitializeCheckout initialize_checkout = 9; + InventoryReserved inventory_reserved = 10; + PaymentStarted payment_started = 11; + PaymentCompleted payment_completed = 12; + PaymentEvent payment_event = 13; + + } +} diff --git a/proto/checkout/checkout.pb.go b/proto/checkout/checkout.pb.go new file mode 100644 index 0000000..f94c407 --- /dev/null +++ b/proto/checkout/checkout.pb.go @@ -0,0 +1,1349 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.5 +// protoc v6.33.1 +// source: checkout.proto + +package checkout_messages + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SetDelivery struct { + state protoimpl.MessageState `protogen:"open.v1"` + Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` + Items []uint32 `protobuf:"varint,2,rep,packed,name=items,proto3" json:"items,omitempty"` + PickupPoint *PickupPoint `protobuf:"bytes,3,opt,name=pickupPoint,proto3,oneof" json:"pickupPoint,omitempty"` + Country string `protobuf:"bytes,4,opt,name=country,proto3" json:"country,omitempty"` + Zip string `protobuf:"bytes,5,opt,name=zip,proto3" json:"zip,omitempty"` + Address *string `protobuf:"bytes,6,opt,name=address,proto3,oneof" json:"address,omitempty"` + City *string `protobuf:"bytes,7,opt,name=city,proto3,oneof" json:"city,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetDelivery) Reset() { + *x = SetDelivery{} + mi := &file_checkout_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetDelivery) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetDelivery) ProtoMessage() {} + +func (x *SetDelivery) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetDelivery.ProtoReflect.Descriptor instead. +func (*SetDelivery) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{0} +} + +func (x *SetDelivery) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *SetDelivery) GetItems() []uint32 { + if x != nil { + return x.Items + } + return nil +} + +func (x *SetDelivery) GetPickupPoint() *PickupPoint { + if x != nil { + return x.PickupPoint + } + return nil +} + +func (x *SetDelivery) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + +func (x *SetDelivery) GetZip() string { + if x != nil { + return x.Zip + } + return "" +} + +func (x *SetDelivery) GetAddress() string { + if x != nil && x.Address != nil { + return *x.Address + } + return "" +} + +func (x *SetDelivery) GetCity() string { + if x != nil && x.City != nil { + return *x.City + } + return "" +} + +type SetPickupPoint struct { + state protoimpl.MessageState `protogen:"open.v1"` + DeliveryId uint32 `protobuf:"varint,1,opt,name=deliveryId,proto3" json:"deliveryId,omitempty"` + PickupPoint *PickupPoint `protobuf:"bytes,2,opt,name=pickupPoint,proto3" json:"pickupPoint,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetPickupPoint) Reset() { + *x = SetPickupPoint{} + mi := &file_checkout_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetPickupPoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetPickupPoint) ProtoMessage() {} + +func (x *SetPickupPoint) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetPickupPoint.ProtoReflect.Descriptor instead. +func (*SetPickupPoint) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{1} +} + +func (x *SetPickupPoint) GetDeliveryId() uint32 { + if x != nil { + return x.DeliveryId + } + return 0 +} + +func (x *SetPickupPoint) GetPickupPoint() *PickupPoint { + if x != nil { + return x.PickupPoint + } + return nil +} + +type PickupPoint struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + Name *string `protobuf:"bytes,3,opt,name=name,proto3,oneof" json:"name,omitempty"` + Address *string `protobuf:"bytes,4,opt,name=address,proto3,oneof" json:"address,omitempty"` + City *string `protobuf:"bytes,5,opt,name=city,proto3,oneof" json:"city,omitempty"` + Zip *string `protobuf:"bytes,6,opt,name=zip,proto3,oneof" json:"zip,omitempty"` + Country *string `protobuf:"bytes,7,opt,name=country,proto3,oneof" json:"country,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PickupPoint) Reset() { + *x = PickupPoint{} + mi := &file_checkout_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PickupPoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PickupPoint) ProtoMessage() {} + +func (x *PickupPoint) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PickupPoint.ProtoReflect.Descriptor instead. +func (*PickupPoint) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{2} +} + +func (x *PickupPoint) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PickupPoint) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *PickupPoint) GetAddress() string { + if x != nil && x.Address != nil { + return *x.Address + } + return "" +} + +func (x *PickupPoint) GetCity() string { + if x != nil && x.City != nil { + return *x.City + } + return "" +} + +func (x *PickupPoint) GetZip() string { + if x != nil && x.Zip != nil { + return *x.Zip + } + return "" +} + +func (x *PickupPoint) GetCountry() string { + if x != nil && x.Country != nil { + return *x.Country + } + return "" +} + +type RemoveDelivery struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveDelivery) Reset() { + *x = RemoveDelivery{} + mi := &file_checkout_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveDelivery) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveDelivery) ProtoMessage() {} + +func (x *RemoveDelivery) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveDelivery.ProtoReflect.Descriptor instead. +func (*RemoveDelivery) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{3} +} + +func (x *RemoveDelivery) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +type PaymentStarted struct { + state protoimpl.MessageState `protogen:"open.v1"` + PaymentId string `protobuf:"bytes,1,opt,name=paymentId,proto3" json:"paymentId,omitempty"` + Amount int64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + Currency string `protobuf:"bytes,4,opt,name=currency,proto3" json:"currency,omitempty"` + Provider string `protobuf:"bytes,5,opt,name=provider,proto3" json:"provider,omitempty"` + Method *string `protobuf:"bytes,6,opt,name=method,proto3,oneof" json:"method,omitempty"` + StartedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=startedAt,proto3,oneof" json:"startedAt,omitempty"` + Items []uint32 `protobuf:"varint,2,rep,packed,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PaymentStarted) Reset() { + *x = PaymentStarted{} + mi := &file_checkout_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PaymentStarted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PaymentStarted) ProtoMessage() {} + +func (x *PaymentStarted) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PaymentStarted.ProtoReflect.Descriptor instead. +func (*PaymentStarted) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{4} +} + +func (x *PaymentStarted) GetPaymentId() string { + if x != nil { + return x.PaymentId + } + return "" +} + +func (x *PaymentStarted) GetAmount() int64 { + if x != nil { + return x.Amount + } + return 0 +} + +func (x *PaymentStarted) GetCurrency() string { + if x != nil { + return x.Currency + } + return "" +} + +func (x *PaymentStarted) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *PaymentStarted) GetMethod() string { + if x != nil && x.Method != nil { + return *x.Method + } + return "" +} + +func (x *PaymentStarted) GetStartedAt() *timestamppb.Timestamp { + if x != nil { + return x.StartedAt + } + return nil +} + +func (x *PaymentStarted) GetItems() []uint32 { + if x != nil { + return x.Items + } + return nil +} + +type PaymentCompleted struct { + state protoimpl.MessageState `protogen:"open.v1"` + PaymentId string `protobuf:"bytes,1,opt,name=paymentId,proto3" json:"paymentId,omitempty"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` + Amount int64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + Currency string `protobuf:"bytes,4,opt,name=currency,proto3" json:"currency,omitempty"` + ProcessorReference *string `protobuf:"bytes,5,opt,name=processorReference,proto3,oneof" json:"processorReference,omitempty"` + CompletedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=completedAt,proto3,oneof" json:"completedAt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PaymentCompleted) Reset() { + *x = PaymentCompleted{} + mi := &file_checkout_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PaymentCompleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PaymentCompleted) ProtoMessage() {} + +func (x *PaymentCompleted) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PaymentCompleted.ProtoReflect.Descriptor instead. +func (*PaymentCompleted) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{5} +} + +func (x *PaymentCompleted) GetPaymentId() string { + if x != nil { + return x.PaymentId + } + return "" +} + +func (x *PaymentCompleted) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *PaymentCompleted) GetAmount() int64 { + if x != nil { + return x.Amount + } + return 0 +} + +func (x *PaymentCompleted) GetCurrency() string { + if x != nil { + return x.Currency + } + return "" +} + +func (x *PaymentCompleted) GetProcessorReference() string { + if x != nil && x.ProcessorReference != nil { + return *x.ProcessorReference + } + return "" +} + +func (x *PaymentCompleted) GetCompletedAt() *timestamppb.Timestamp { + if x != nil { + return x.CompletedAt + } + return nil +} + +type PaymentDeclined struct { + state protoimpl.MessageState `protogen:"open.v1"` + PaymentId string `protobuf:"bytes,1,opt,name=paymentId,proto3" json:"paymentId,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + Code *string `protobuf:"bytes,3,opt,name=code,proto3,oneof" json:"code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PaymentDeclined) Reset() { + *x = PaymentDeclined{} + mi := &file_checkout_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PaymentDeclined) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PaymentDeclined) ProtoMessage() {} + +func (x *PaymentDeclined) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PaymentDeclined.ProtoReflect.Descriptor instead. +func (*PaymentDeclined) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{6} +} + +func (x *PaymentDeclined) GetPaymentId() string { + if x != nil { + return x.PaymentId + } + return "" +} + +func (x *PaymentDeclined) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *PaymentDeclined) GetCode() string { + if x != nil && x.Code != nil { + return *x.Code + } + return "" +} + +type PaymentEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + PaymentId string `protobuf:"bytes,1,opt,name=paymentId,proto3" json:"paymentId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"` + Data *anypb.Any `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PaymentEvent) Reset() { + *x = PaymentEvent{} + mi := &file_checkout_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PaymentEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PaymentEvent) ProtoMessage() {} + +func (x *PaymentEvent) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PaymentEvent.ProtoReflect.Descriptor instead. +func (*PaymentEvent) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{7} +} + +func (x *PaymentEvent) GetPaymentId() string { + if x != nil { + return x.PaymentId + } + return "" +} + +func (x *PaymentEvent) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PaymentEvent) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *PaymentEvent) GetData() *anypb.Any { + if x != nil { + return x.Data + } + return nil +} + +type ConfirmationViewed struct { + state protoimpl.MessageState `protogen:"open.v1"` + ViewedAt *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=viewedAt,proto3" json:"viewedAt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConfirmationViewed) Reset() { + *x = ConfirmationViewed{} + mi := &file_checkout_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfirmationViewed) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfirmationViewed) ProtoMessage() {} + +func (x *ConfirmationViewed) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfirmationViewed.ProtoReflect.Descriptor instead. +func (*ConfirmationViewed) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{8} +} + +func (x *ConfirmationViewed) GetViewedAt() *timestamppb.Timestamp { + if x != nil { + return x.ViewedAt + } + return nil +} + +type OrderCreated struct { + state protoimpl.MessageState `protogen:"open.v1"` + OrderId string `protobuf:"bytes,1,opt,name=orderId,proto3" json:"orderId,omitempty"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OrderCreated) Reset() { + *x = OrderCreated{} + mi := &file_checkout_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OrderCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OrderCreated) ProtoMessage() {} + +func (x *OrderCreated) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OrderCreated.ProtoReflect.Descriptor instead. +func (*OrderCreated) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{9} +} + +func (x *OrderCreated) GetOrderId() string { + if x != nil { + return x.OrderId + } + return "" +} + +func (x *OrderCreated) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *OrderCreated) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +type InitializeCheckout struct { + state protoimpl.MessageState `protogen:"open.v1"` + OrderId string `protobuf:"bytes,1,opt,name=orderId,proto3" json:"orderId,omitempty"` + CartId uint64 `protobuf:"varint,2,opt,name=cartId,proto3" json:"cartId,omitempty"` + Version uint32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` + CartState *anypb.Any `protobuf:"bytes,4,opt,name=cartState,proto3" json:"cartState,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InitializeCheckout) Reset() { + *x = InitializeCheckout{} + mi := &file_checkout_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InitializeCheckout) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InitializeCheckout) ProtoMessage() {} + +func (x *InitializeCheckout) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InitializeCheckout.ProtoReflect.Descriptor instead. +func (*InitializeCheckout) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{10} +} + +func (x *InitializeCheckout) GetOrderId() string { + if x != nil { + return x.OrderId + } + return "" +} + +func (x *InitializeCheckout) GetCartId() uint64 { + if x != nil { + return x.CartId + } + return 0 +} + +func (x *InitializeCheckout) GetVersion() uint32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *InitializeCheckout) GetCartState() *anypb.Any { + if x != nil { + return x.CartState + } + return nil +} + +type InventoryReserved struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` + Message *string `protobuf:"bytes,3,opt,name=message,proto3,oneof" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InventoryReserved) Reset() { + *x = InventoryReserved{} + mi := &file_checkout_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InventoryReserved) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InventoryReserved) ProtoMessage() {} + +func (x *InventoryReserved) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InventoryReserved.ProtoReflect.Descriptor instead. +func (*InventoryReserved) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{11} +} + +func (x *InventoryReserved) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *InventoryReserved) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *InventoryReserved) GetMessage() string { + if x != nil && x.Message != nil { + return *x.Message + } + return "" +} + +type Mutation struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Type: + // + // *Mutation_SetDelivery + // *Mutation_SetPickupPoint + // *Mutation_RemoveDelivery + // *Mutation_PaymentDeclined + // *Mutation_ConfirmationViewed + // *Mutation_OrderCreated + // *Mutation_InitializeCheckout + // *Mutation_InventoryReserved + // *Mutation_PaymentStarted + // *Mutation_PaymentCompleted + // *Mutation_PaymentEvent + Type isMutation_Type `protobuf_oneof:"type"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Mutation) Reset() { + *x = Mutation{} + mi := &file_checkout_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Mutation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Mutation) ProtoMessage() {} + +func (x *Mutation) ProtoReflect() protoreflect.Message { + mi := &file_checkout_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Mutation.ProtoReflect.Descriptor instead. +func (*Mutation) Descriptor() ([]byte, []int) { + return file_checkout_proto_rawDescGZIP(), []int{12} +} + +func (x *Mutation) GetType() isMutation_Type { + if x != nil { + return x.Type + } + return nil +} + +func (x *Mutation) GetSetDelivery() *SetDelivery { + if x != nil { + if x, ok := x.Type.(*Mutation_SetDelivery); ok { + return x.SetDelivery + } + } + return nil +} + +func (x *Mutation) GetSetPickupPoint() *SetPickupPoint { + if x != nil { + if x, ok := x.Type.(*Mutation_SetPickupPoint); ok { + return x.SetPickupPoint + } + } + return nil +} + +func (x *Mutation) GetRemoveDelivery() *RemoveDelivery { + if x != nil { + if x, ok := x.Type.(*Mutation_RemoveDelivery); ok { + return x.RemoveDelivery + } + } + return nil +} + +func (x *Mutation) GetPaymentDeclined() *PaymentDeclined { + if x != nil { + if x, ok := x.Type.(*Mutation_PaymentDeclined); ok { + return x.PaymentDeclined + } + } + return nil +} + +func (x *Mutation) GetConfirmationViewed() *ConfirmationViewed { + if x != nil { + if x, ok := x.Type.(*Mutation_ConfirmationViewed); ok { + return x.ConfirmationViewed + } + } + return nil +} + +func (x *Mutation) GetOrderCreated() *OrderCreated { + if x != nil { + if x, ok := x.Type.(*Mutation_OrderCreated); ok { + return x.OrderCreated + } + } + return nil +} + +func (x *Mutation) GetInitializeCheckout() *InitializeCheckout { + if x != nil { + if x, ok := x.Type.(*Mutation_InitializeCheckout); ok { + return x.InitializeCheckout + } + } + return nil +} + +func (x *Mutation) GetInventoryReserved() *InventoryReserved { + if x != nil { + if x, ok := x.Type.(*Mutation_InventoryReserved); ok { + return x.InventoryReserved + } + } + return nil +} + +func (x *Mutation) GetPaymentStarted() *PaymentStarted { + if x != nil { + if x, ok := x.Type.(*Mutation_PaymentStarted); ok { + return x.PaymentStarted + } + } + return nil +} + +func (x *Mutation) GetPaymentCompleted() *PaymentCompleted { + if x != nil { + if x, ok := x.Type.(*Mutation_PaymentCompleted); ok { + return x.PaymentCompleted + } + } + return nil +} + +func (x *Mutation) GetPaymentEvent() *PaymentEvent { + if x != nil { + if x, ok := x.Type.(*Mutation_PaymentEvent); ok { + return x.PaymentEvent + } + } + return nil +} + +type isMutation_Type interface { + isMutation_Type() +} + +type Mutation_SetDelivery struct { + SetDelivery *SetDelivery `protobuf:"bytes,1,opt,name=set_delivery,json=setDelivery,proto3,oneof"` +} + +type Mutation_SetPickupPoint struct { + SetPickupPoint *SetPickupPoint `protobuf:"bytes,2,opt,name=set_pickup_point,json=setPickupPoint,proto3,oneof"` +} + +type Mutation_RemoveDelivery struct { + RemoveDelivery *RemoveDelivery `protobuf:"bytes,3,opt,name=remove_delivery,json=removeDelivery,proto3,oneof"` +} + +type Mutation_PaymentDeclined struct { + PaymentDeclined *PaymentDeclined `protobuf:"bytes,4,opt,name=payment_declined,json=paymentDeclined,proto3,oneof"` +} + +type Mutation_ConfirmationViewed struct { + ConfirmationViewed *ConfirmationViewed `protobuf:"bytes,5,opt,name=confirmation_viewed,json=confirmationViewed,proto3,oneof"` +} + +type Mutation_OrderCreated struct { + OrderCreated *OrderCreated `protobuf:"bytes,7,opt,name=order_created,json=orderCreated,proto3,oneof"` +} + +type Mutation_InitializeCheckout struct { + InitializeCheckout *InitializeCheckout `protobuf:"bytes,9,opt,name=initialize_checkout,json=initializeCheckout,proto3,oneof"` +} + +type Mutation_InventoryReserved struct { + InventoryReserved *InventoryReserved `protobuf:"bytes,10,opt,name=inventory_reserved,json=inventoryReserved,proto3,oneof"` +} + +type Mutation_PaymentStarted struct { + PaymentStarted *PaymentStarted `protobuf:"bytes,11,opt,name=payment_started,json=paymentStarted,proto3,oneof"` +} + +type Mutation_PaymentCompleted struct { + PaymentCompleted *PaymentCompleted `protobuf:"bytes,12,opt,name=payment_completed,json=paymentCompleted,proto3,oneof"` +} + +type Mutation_PaymentEvent struct { + PaymentEvent *PaymentEvent `protobuf:"bytes,13,opt,name=payment_event,json=paymentEvent,proto3,oneof"` +} + +func (*Mutation_SetDelivery) isMutation_Type() {} + +func (*Mutation_SetPickupPoint) isMutation_Type() {} + +func (*Mutation_RemoveDelivery) isMutation_Type() {} + +func (*Mutation_PaymentDeclined) isMutation_Type() {} + +func (*Mutation_ConfirmationViewed) isMutation_Type() {} + +func (*Mutation_OrderCreated) isMutation_Type() {} + +func (*Mutation_InitializeCheckout) isMutation_Type() {} + +func (*Mutation_InventoryReserved) isMutation_Type() {} + +func (*Mutation_PaymentStarted) isMutation_Type() {} + +func (*Mutation_PaymentCompleted) isMutation_Type() {} + +func (*Mutation_PaymentEvent) isMutation_Type() {} + +var File_checkout_proto protoreflect.FileDescriptor + +var file_checkout_proto_rawDesc = string([]byte{ + 0x0a, 0x0e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x11, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x8f, 0x02, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, + 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, + 0x73, 0x12, 0x45, 0x0a, 0x0b, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, + 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x69, 0x63, 0x6b, 0x75, + 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, + 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x7a, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x7a, 0x69, 0x70, 0x12, 0x1d, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x02, 0x52, 0x04, 0x63, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, + 0x5f, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x42, 0x0a, 0x0a, 0x08, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x63, 0x69, 0x74, + 0x79, 0x22, 0x72, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, + 0x69, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, + 0x79, 0x49, 0x64, 0x12, 0x40, 0x0a, 0x0b, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, + 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x69, 0x63, + 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x0b, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, + 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x22, 0xd6, 0x01, 0x0a, 0x0b, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, + 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1d, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, + 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x04, 0x63, + 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x7a, 0x69, 0x70, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x03, 0x7a, 0x69, 0x70, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, + 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, + 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x63, 0x69, 0x74, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x7a, + 0x69, 0x70, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x20, + 0x0a, 0x0e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x89, 0x02, 0x0a, 0x0e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x72, + 0x74, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, + 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x12, 0x1b, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x88, 0x01, 0x01, 0x12, 0x3d, + 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x48, 0x01, 0x52, + 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, 0x88, 0x01, 0x01, 0x12, 0x14, 0x0a, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x74, + 0x65, 0x6d, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x42, 0x0c, + 0x0a, 0x0a, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x9b, 0x02, 0x0a, + 0x10, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x33, 0x0a, 0x12, 0x70, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x6f, 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x41, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x48, 0x01, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x88, 0x01, 0x01, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x6f, + 0x72, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x63, + 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x6b, 0x0a, 0x0f, 0x50, 0x61, + 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x1c, 0x0a, + 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x84, 0x01, 0x0a, 0x0c, 0x50, 0x61, 0x79, 0x6d, + 0x65, 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x79, 0x6d, + 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x79, + 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x4c, + 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x69, + 0x65, 0x77, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x08, 0x76, 0x69, 0x65, 0x77, 0x65, 0x64, 0x41, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x08, 0x76, 0x69, 0x65, 0x77, 0x65, 0x64, 0x41, 0x74, 0x22, 0x7a, 0x0a, 0x0c, + 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, + 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x38, + 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x12, 0x49, 0x6e, 0x69, + 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x72, + 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x63, 0x61, 0x72, 0x74, 0x49, + 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x0a, 0x09, 0x63, + 0x61, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x09, 0x63, 0x61, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, + 0x66, 0x0a, 0x11, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x07, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x82, 0x07, 0x0a, 0x08, 0x4d, 0x75, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x0c, 0x73, 0x65, 0x74, 0x5f, 0x64, 0x65, 0x6c, 0x69, + 0x76, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x68, 0x65, + 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x53, + 0x65, 0x74, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x65, + 0x74, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, 0x4d, 0x0a, 0x10, 0x73, 0x65, 0x74, + 0x5f, 0x70, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x69, 0x63, 0x6b, 0x75, + 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x65, 0x74, 0x50, 0x69, 0x63, + 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0f, 0x72, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x69, + 0x76, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, + 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, 0x4f, 0x0a, 0x10, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x22, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, 0x6c, + 0x69, 0x6e, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, + 0x65, 0x63, 0x6c, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x65, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x69, 0x65, 0x77, 0x65, 0x64, 0x48, 0x00, 0x52, 0x12, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x69, 0x65, 0x77, 0x65, + 0x64, 0x12, 0x46, 0x0a, 0x0d, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, + 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x72, 0x64, + 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0c, 0x6f, 0x72, 0x64, + 0x65, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x13, 0x69, 0x6e, 0x69, + 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, + 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x69, + 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x48, 0x00, 0x52, + 0x12, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x6f, 0x75, 0x74, 0x12, 0x55, 0x0a, 0x12, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, + 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x48, 0x00, 0x52, 0x11, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, + 0x72, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x4c, 0x0a, 0x0f, 0x70, 0x61, + 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0e, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x52, 0x0a, 0x11, 0x70, 0x61, 0x79, 0x6d, + 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, + 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x10, 0x70, 0x61, 0x79, 0x6d, + 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x46, 0x0a, 0x0d, + 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x0d, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0c, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x3c, 0x5a, 0x3a, + 0x67, 0x69, 0x74, 0x2e, 0x6b, 0x36, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x2d, 0x63, + 0x61, 0x72, 0x74, 0x2d, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, 0x74, 0x3b, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6f, 0x75, + 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +}) + +var ( + file_checkout_proto_rawDescOnce sync.Once + file_checkout_proto_rawDescData []byte +) + +func file_checkout_proto_rawDescGZIP() []byte { + file_checkout_proto_rawDescOnce.Do(func() { + file_checkout_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_checkout_proto_rawDesc), len(file_checkout_proto_rawDesc))) + }) + return file_checkout_proto_rawDescData +} + +var file_checkout_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_checkout_proto_goTypes = []any{ + (*SetDelivery)(nil), // 0: checkout_messages.SetDelivery + (*SetPickupPoint)(nil), // 1: checkout_messages.SetPickupPoint + (*PickupPoint)(nil), // 2: checkout_messages.PickupPoint + (*RemoveDelivery)(nil), // 3: checkout_messages.RemoveDelivery + (*PaymentStarted)(nil), // 4: checkout_messages.PaymentStarted + (*PaymentCompleted)(nil), // 5: checkout_messages.PaymentCompleted + (*PaymentDeclined)(nil), // 6: checkout_messages.PaymentDeclined + (*PaymentEvent)(nil), // 7: checkout_messages.PaymentEvent + (*ConfirmationViewed)(nil), // 8: checkout_messages.ConfirmationViewed + (*OrderCreated)(nil), // 9: checkout_messages.OrderCreated + (*InitializeCheckout)(nil), // 10: checkout_messages.InitializeCheckout + (*InventoryReserved)(nil), // 11: checkout_messages.InventoryReserved + (*Mutation)(nil), // 12: checkout_messages.Mutation + (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp + (*anypb.Any)(nil), // 14: google.protobuf.Any +} +var file_checkout_proto_depIdxs = []int32{ + 2, // 0: checkout_messages.SetDelivery.pickupPoint:type_name -> checkout_messages.PickupPoint + 2, // 1: checkout_messages.SetPickupPoint.pickupPoint:type_name -> checkout_messages.PickupPoint + 13, // 2: checkout_messages.PaymentStarted.startedAt:type_name -> google.protobuf.Timestamp + 13, // 3: checkout_messages.PaymentCompleted.completedAt:type_name -> google.protobuf.Timestamp + 14, // 4: checkout_messages.PaymentEvent.data:type_name -> google.protobuf.Any + 13, // 5: checkout_messages.ConfirmationViewed.viewedAt:type_name -> google.protobuf.Timestamp + 13, // 6: checkout_messages.OrderCreated.createdAt:type_name -> google.protobuf.Timestamp + 14, // 7: checkout_messages.InitializeCheckout.cartState:type_name -> google.protobuf.Any + 0, // 8: checkout_messages.Mutation.set_delivery:type_name -> checkout_messages.SetDelivery + 1, // 9: checkout_messages.Mutation.set_pickup_point:type_name -> checkout_messages.SetPickupPoint + 3, // 10: checkout_messages.Mutation.remove_delivery:type_name -> checkout_messages.RemoveDelivery + 6, // 11: checkout_messages.Mutation.payment_declined:type_name -> checkout_messages.PaymentDeclined + 8, // 12: checkout_messages.Mutation.confirmation_viewed:type_name -> checkout_messages.ConfirmationViewed + 9, // 13: checkout_messages.Mutation.order_created:type_name -> checkout_messages.OrderCreated + 10, // 14: checkout_messages.Mutation.initialize_checkout:type_name -> checkout_messages.InitializeCheckout + 11, // 15: checkout_messages.Mutation.inventory_reserved:type_name -> checkout_messages.InventoryReserved + 4, // 16: checkout_messages.Mutation.payment_started:type_name -> checkout_messages.PaymentStarted + 5, // 17: checkout_messages.Mutation.payment_completed:type_name -> checkout_messages.PaymentCompleted + 7, // 18: checkout_messages.Mutation.payment_event:type_name -> checkout_messages.PaymentEvent + 19, // [19:19] is the sub-list for method output_type + 19, // [19:19] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name +} + +func init() { file_checkout_proto_init() } +func file_checkout_proto_init() { + if File_checkout_proto != nil { + return + } + file_checkout_proto_msgTypes[0].OneofWrappers = []any{} + file_checkout_proto_msgTypes[2].OneofWrappers = []any{} + file_checkout_proto_msgTypes[4].OneofWrappers = []any{} + file_checkout_proto_msgTypes[5].OneofWrappers = []any{} + file_checkout_proto_msgTypes[6].OneofWrappers = []any{} + file_checkout_proto_msgTypes[11].OneofWrappers = []any{} + file_checkout_proto_msgTypes[12].OneofWrappers = []any{ + (*Mutation_SetDelivery)(nil), + (*Mutation_SetPickupPoint)(nil), + (*Mutation_RemoveDelivery)(nil), + (*Mutation_PaymentDeclined)(nil), + (*Mutation_ConfirmationViewed)(nil), + (*Mutation_OrderCreated)(nil), + (*Mutation_InitializeCheckout)(nil), + (*Mutation_InventoryReserved)(nil), + (*Mutation_PaymentStarted)(nil), + (*Mutation_PaymentCompleted)(nil), + (*Mutation_PaymentEvent)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_checkout_proto_rawDesc), len(file_checkout_proto_rawDesc)), + NumEnums: 0, + NumMessages: 13, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_checkout_proto_goTypes, + DependencyIndexes: file_checkout_proto_depIdxs, + MessageInfos: file_checkout_proto_msgTypes, + }.Build() + File_checkout_proto = out.File + file_checkout_proto_goTypes = nil + file_checkout_proto_depIdxs = nil +} diff --git a/pkg/messages/control_plane.pb.go b/proto/control/control_plane.pb.go similarity index 62% rename from pkg/messages/control_plane.pb.go rename to proto/control/control_plane.pb.go index c3d6f0c..5c97e10 100644 --- a/pkg/messages/control_plane.pb.go +++ b/proto/control/control_plane.pb.go @@ -4,7 +4,7 @@ // protoc v6.33.1 // source: control_plane.proto -package messages +package control_plane_messages import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -640,84 +640,100 @@ var File_control_plane_proto protoreflect.FileDescriptor var file_control_plane_proto_rawDesc = string([]byte{ 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x1a, - 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x3c, 0x0a, 0x09, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x74, 0x69, 0x6d, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x75, 0x6e, 0x69, 0x78, 0x54, 0x69, 0x6d, - 0x65, 0x22, 0x33, 0x0a, 0x10, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x68, - 0x6f, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6b, 0x6e, 0x6f, 0x77, - 0x6e, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x22, 0x26, 0x0a, 0x0e, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x6f, 0x73, 0x74, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x22, 0x21, - 0x0a, 0x0d, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x03, 0x69, 0x64, - 0x73, 0x22, 0x46, 0x0a, 0x0e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, - 0x41, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x12, - 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x23, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, - 0x73, 0x69, 0x6e, 0x67, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, - 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x22, 0x39, - 0x0a, 0x11, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x41, 0x6e, 0x6e, 0x6f, 0x75, - 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x04, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x36, 0x0a, 0x0e, 0x45, 0x78, 0x70, - 0x69, 0x72, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, - 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, - 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x52, 0x03, 0x69, 0x64, - 0x73, 0x22, 0x50, 0x0a, 0x0c, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x22, 0x1c, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, - 0x64, 0x22, 0x36, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2a, 0x0a, - 0x05, 0x67, 0x72, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, - 0x6e, 0x79, 0x52, 0x05, 0x67, 0x72, 0x61, 0x69, 0x6e, 0x22, 0x29, 0x0a, 0x0b, 0x41, 0x70, 0x70, - 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, - 0x70, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, - 0x70, 0x74, 0x65, 0x64, 0x32, 0xf6, 0x03, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x50, 0x6c, 0x61, 0x6e, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x0f, 0x2e, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x13, - 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x12, 0x41, 0x0a, 0x09, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, - 0x12, 0x1a, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4e, 0x65, 0x67, 0x6f, - 0x74, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3c, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, - 0x61, 0x6c, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x73, 0x12, 0x0f, 0x2e, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x73, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x12, 0x4a, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, - 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x1b, 0x2e, 0x6d, 0x65, 0x73, 0x73, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, + 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x1a, 0x19, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, + 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x22, 0x3c, 0x0a, 0x09, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x12, + 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, + 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x75, 0x6e, 0x69, 0x78, 0x54, 0x69, 0x6d, 0x65, 0x22, + 0x33, 0x0a, 0x10, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x68, 0x6f, 0x73, + 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x48, + 0x6f, 0x73, 0x74, 0x73, 0x22, 0x26, 0x0a, 0x0e, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x22, 0x21, 0x0a, 0x0d, + 0x41, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, + 0x46, 0x0a, 0x0e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, + 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x23, 0x0a, 0x0d, 0x43, 0x6c, 0x6f, 0x73, 0x69, + 0x6e, 0x67, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x22, 0x39, 0x0a, 0x11, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x04, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x36, 0x0a, 0x0e, 0x45, 0x78, 0x70, 0x69, 0x72, + 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x10, 0x0a, + 0x03, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, + 0x50, 0x0a, 0x0c, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x22, 0x1c, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x22, + 0x36, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x67, + 0x72, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, + 0x52, 0x05, 0x67, 0x72, 0x61, 0x69, 0x6e, 0x22, 0x29, 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x6c, 0x79, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, + 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, + 0x65, 0x64, 0x32, 0xd6, 0x05, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x50, 0x6c, + 0x61, 0x6e, 0x65, 0x12, 0x48, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x1d, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x21, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x5d, 0x0a, + 0x09, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x2e, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, + 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4e, 0x65, + 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x58, 0x0a, 0x10, + 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x73, + 0x12, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, + 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x25, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, + 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x66, 0x0a, 0x11, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, + 0x63, 0x65, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x29, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x41, 0x6e, - 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x6b, - 0x12, 0x36, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x16, 0x2e, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x70, 0x70, - 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x44, 0x0a, 0x0e, 0x41, 0x6e, 0x6e, 0x6f, - 0x75, 0x6e, 0x63, 0x65, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x18, 0x2e, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x41, 0x6e, 0x6e, 0x6f, - 0x75, 0x6e, 0x63, 0x65, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, - 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x6b, 0x12, 0x3c, - 0x0a, 0x07, 0x43, 0x6c, 0x6f, 0x73, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x2e, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x69, 0x6e, 0x67, 0x4e, 0x6f, 0x74, 0x69, - 0x63, 0x65, 0x1a, 0x18, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x77, - 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x6b, 0x12, 0x2f, 0x0a, 0x03, - 0x47, 0x65, 0x74, 0x12, 0x14, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x2a, 0x5a, - 0x28, 0x67, 0x69, 0x74, 0x2e, 0x6b, 0x36, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x2d, - 0x63, 0x61, 0x72, 0x74, 0x2d, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x3b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x6b, 0x12, 0x52, + 0x0a, 0x05, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, + 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x12, 0x60, 0x0a, 0x0e, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x45, 0x78, + 0x70, 0x69, 0x72, 0x79, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, + 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x45, 0x78, + 0x70, 0x69, 0x72, 0x79, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x1a, 0x26, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x41, 0x63, 0x6b, 0x12, 0x58, 0x0a, 0x07, 0x43, 0x6c, 0x6f, 0x73, 0x69, 0x6e, 0x67, 0x12, + 0x25, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x69, 0x6e, 0x67, + 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, + 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x41, 0x63, 0x6b, 0x12, 0x4b, + 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x22, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, + 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x40, 0x5a, 0x3e, 0x67, + 0x69, 0x74, 0x2e, 0x6b, 0x36, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x61, + 0x72, 0x74, 0x2d, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x3b, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x70, + 0x6c, 0x61, 0x6e, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, }) var ( @@ -734,40 +750,40 @@ func file_control_plane_proto_rawDescGZIP() []byte { var file_control_plane_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_control_plane_proto_goTypes = []any{ - (*Empty)(nil), // 0: messages.Empty - (*PingReply)(nil), // 1: messages.PingReply - (*NegotiateRequest)(nil), // 2: messages.NegotiateRequest - (*NegotiateReply)(nil), // 3: messages.NegotiateReply - (*ActorIdsReply)(nil), // 4: messages.ActorIdsReply - (*OwnerChangeAck)(nil), // 5: messages.OwnerChangeAck - (*ClosingNotice)(nil), // 6: messages.ClosingNotice - (*OwnershipAnnounce)(nil), // 7: messages.OwnershipAnnounce - (*ExpiryAnnounce)(nil), // 8: messages.ExpiryAnnounce - (*ApplyRequest)(nil), // 9: messages.ApplyRequest - (*GetRequest)(nil), // 10: messages.GetRequest - (*GetReply)(nil), // 11: messages.GetReply - (*ApplyResult)(nil), // 12: messages.ApplyResult + (*Empty)(nil), // 0: control_plane_messages.Empty + (*PingReply)(nil), // 1: control_plane_messages.PingReply + (*NegotiateRequest)(nil), // 2: control_plane_messages.NegotiateRequest + (*NegotiateReply)(nil), // 3: control_plane_messages.NegotiateReply + (*ActorIdsReply)(nil), // 4: control_plane_messages.ActorIdsReply + (*OwnerChangeAck)(nil), // 5: control_plane_messages.OwnerChangeAck + (*ClosingNotice)(nil), // 6: control_plane_messages.ClosingNotice + (*OwnershipAnnounce)(nil), // 7: control_plane_messages.OwnershipAnnounce + (*ExpiryAnnounce)(nil), // 8: control_plane_messages.ExpiryAnnounce + (*ApplyRequest)(nil), // 9: control_plane_messages.ApplyRequest + (*GetRequest)(nil), // 10: control_plane_messages.GetRequest + (*GetReply)(nil), // 11: control_plane_messages.GetReply + (*ApplyResult)(nil), // 12: control_plane_messages.ApplyResult (*anypb.Any)(nil), // 13: google.protobuf.Any } var file_control_plane_proto_depIdxs = []int32{ - 13, // 0: messages.ApplyRequest.messages:type_name -> google.protobuf.Any - 13, // 1: messages.GetReply.grain:type_name -> google.protobuf.Any - 0, // 2: messages.ControlPlane.Ping:input_type -> messages.Empty - 2, // 3: messages.ControlPlane.Negotiate:input_type -> messages.NegotiateRequest - 0, // 4: messages.ControlPlane.GetLocalActorIds:input_type -> messages.Empty - 7, // 5: messages.ControlPlane.AnnounceOwnership:input_type -> messages.OwnershipAnnounce - 9, // 6: messages.ControlPlane.Apply:input_type -> messages.ApplyRequest - 8, // 7: messages.ControlPlane.AnnounceExpiry:input_type -> messages.ExpiryAnnounce - 6, // 8: messages.ControlPlane.Closing:input_type -> messages.ClosingNotice - 10, // 9: messages.ControlPlane.Get:input_type -> messages.GetRequest - 1, // 10: messages.ControlPlane.Ping:output_type -> messages.PingReply - 3, // 11: messages.ControlPlane.Negotiate:output_type -> messages.NegotiateReply - 4, // 12: messages.ControlPlane.GetLocalActorIds:output_type -> messages.ActorIdsReply - 5, // 13: messages.ControlPlane.AnnounceOwnership:output_type -> messages.OwnerChangeAck - 12, // 14: messages.ControlPlane.Apply:output_type -> messages.ApplyResult - 5, // 15: messages.ControlPlane.AnnounceExpiry:output_type -> messages.OwnerChangeAck - 5, // 16: messages.ControlPlane.Closing:output_type -> messages.OwnerChangeAck - 11, // 17: messages.ControlPlane.Get:output_type -> messages.GetReply + 13, // 0: control_plane_messages.ApplyRequest.messages:type_name -> google.protobuf.Any + 13, // 1: control_plane_messages.GetReply.grain:type_name -> google.protobuf.Any + 0, // 2: control_plane_messages.ControlPlane.Ping:input_type -> control_plane_messages.Empty + 2, // 3: control_plane_messages.ControlPlane.Negotiate:input_type -> control_plane_messages.NegotiateRequest + 0, // 4: control_plane_messages.ControlPlane.GetLocalActorIds:input_type -> control_plane_messages.Empty + 7, // 5: control_plane_messages.ControlPlane.AnnounceOwnership:input_type -> control_plane_messages.OwnershipAnnounce + 9, // 6: control_plane_messages.ControlPlane.Apply:input_type -> control_plane_messages.ApplyRequest + 8, // 7: control_plane_messages.ControlPlane.AnnounceExpiry:input_type -> control_plane_messages.ExpiryAnnounce + 6, // 8: control_plane_messages.ControlPlane.Closing:input_type -> control_plane_messages.ClosingNotice + 10, // 9: control_plane_messages.ControlPlane.Get:input_type -> control_plane_messages.GetRequest + 1, // 10: control_plane_messages.ControlPlane.Ping:output_type -> control_plane_messages.PingReply + 3, // 11: control_plane_messages.ControlPlane.Negotiate:output_type -> control_plane_messages.NegotiateReply + 4, // 12: control_plane_messages.ControlPlane.GetLocalActorIds:output_type -> control_plane_messages.ActorIdsReply + 5, // 13: control_plane_messages.ControlPlane.AnnounceOwnership:output_type -> control_plane_messages.OwnerChangeAck + 12, // 14: control_plane_messages.ControlPlane.Apply:output_type -> control_plane_messages.ApplyResult + 5, // 15: control_plane_messages.ControlPlane.AnnounceExpiry:output_type -> control_plane_messages.OwnerChangeAck + 5, // 16: control_plane_messages.ControlPlane.Closing:output_type -> control_plane_messages.OwnerChangeAck + 11, // 17: control_plane_messages.ControlPlane.Get:output_type -> control_plane_messages.GetReply 10, // [10:18] is the sub-list for method output_type 2, // [2:10] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name diff --git a/pkg/messages/control_plane_grpc.pb.go b/proto/control/control_plane_grpc.pb.go similarity index 94% rename from pkg/messages/control_plane_grpc.pb.go rename to proto/control/control_plane_grpc.pb.go index c3fd3ad..912ed94 100644 --- a/pkg/messages/control_plane_grpc.pb.go +++ b/proto/control/control_plane_grpc.pb.go @@ -4,7 +4,7 @@ // - protoc v6.33.1 // source: control_plane.proto -package messages +package control_plane_messages import ( context "context" @@ -19,14 +19,14 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - ControlPlane_Ping_FullMethodName = "/messages.ControlPlane/Ping" - ControlPlane_Negotiate_FullMethodName = "/messages.ControlPlane/Negotiate" - ControlPlane_GetLocalActorIds_FullMethodName = "/messages.ControlPlane/GetLocalActorIds" - ControlPlane_AnnounceOwnership_FullMethodName = "/messages.ControlPlane/AnnounceOwnership" - ControlPlane_Apply_FullMethodName = "/messages.ControlPlane/Apply" - ControlPlane_AnnounceExpiry_FullMethodName = "/messages.ControlPlane/AnnounceExpiry" - ControlPlane_Closing_FullMethodName = "/messages.ControlPlane/Closing" - ControlPlane_Get_FullMethodName = "/messages.ControlPlane/Get" + ControlPlane_Ping_FullMethodName = "/control_plane_messages.ControlPlane/Ping" + ControlPlane_Negotiate_FullMethodName = "/control_plane_messages.ControlPlane/Negotiate" + ControlPlane_GetLocalActorIds_FullMethodName = "/control_plane_messages.ControlPlane/GetLocalActorIds" + ControlPlane_AnnounceOwnership_FullMethodName = "/control_plane_messages.ControlPlane/AnnounceOwnership" + ControlPlane_Apply_FullMethodName = "/control_plane_messages.ControlPlane/Apply" + ControlPlane_AnnounceExpiry_FullMethodName = "/control_plane_messages.ControlPlane/AnnounceExpiry" + ControlPlane_Closing_FullMethodName = "/control_plane_messages.ControlPlane/Closing" + ControlPlane_Get_FullMethodName = "/control_plane_messages.ControlPlane/Get" ) // ControlPlaneClient is the client API for ControlPlane service. @@ -362,7 +362,7 @@ func _ControlPlane_Get_Handler(srv interface{}, ctx context.Context, dec func(in // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var ControlPlane_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "messages.ControlPlane", + ServiceName: "control_plane_messages.ControlPlane", HandlerType: (*ControlPlaneServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/proto/control_plane.proto b/proto/control_plane.proto index 80b7b1a..bf8568b 100644 --- a/proto/control_plane.proto +++ b/proto/control_plane.proto @@ -1,8 +1,8 @@ syntax = "proto3"; -package messages; +package control_plane_messages; -option go_package = "git.k6n.net/go-cart-actor/proto;messages"; +option go_package = "git.k6n.net/go-cart-actor/proto/control;control_plane_messages"; import "google/protobuf/any.proto"; diff --git a/proto/messages.proto b/proto/messages.proto deleted file mode 100644 index ce2bd27..0000000 --- a/proto/messages.proto +++ /dev/null @@ -1,232 +0,0 @@ -syntax = "proto3"; -package messages; -option go_package = "git.k6n.net/go-cart-actor/proto;messages"; - -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -message ClearCartRequest {} - -message AddItem { - uint32 item_id = 1; - int32 quantity = 2; - int64 price = 3; - int64 orgPrice = 9; - string sku = 4; - string name = 5; - string image = 6; - int32 stock = 7; - int32 tax = 8; - string brand = 13; - string category = 14; - string category2 = 15; - string category3 = 16; - string category4 = 17; - string category5 = 18; - string disclaimer = 10; - string articleType = 11; - string sellerId = 19; - string sellerName = 20; - string country = 21; - string saleStatus = 24; - optional string outlet = 12; - optional string storeId = 22; - optional uint32 parentId = 23; - string cgm = 25; - optional google.protobuf.Timestamp reservationEndTime = 26; -} - -message RemoveItem { uint32 Id = 1; } - -message ChangeQuantity { - uint32 Id = 1; - int32 quantity = 2; -} - -message SetDelivery { - string provider = 1; - repeated uint32 items = 2; - optional PickupPoint pickupPoint = 3; - string country = 4; - string zip = 5; - optional string address = 6; - optional string city = 7; -} - -message SetPickupPoint { - uint32 deliveryId = 1; - string id = 2; - optional string name = 3; - optional string address = 4; - optional string city = 5; - optional string zip = 6; - optional string country = 7; -} - -message PickupPoint { - string id = 1; - optional string name = 2; - optional string address = 3; - optional string city = 4; - optional string zip = 5; - optional string country = 6; -} - -message RemoveDelivery { uint32 id = 1; } - -message SetUserId { - string userId = 1; -} - -message LineItemMarking { - uint32 id = 1; - uint32 type = 2; - string marking = 3; -} - -message RemoveLineItemMarking { - uint32 id = 1; -} - -message SubscriptionAdded { - uint32 itemId = 1; - string detailsId = 3; - string orderReference = 4; -} - -message PaymentStarted { - string paymentId = 1; - uint32 version = 2; - int64 amount = 3; - string currency = 4; - string provider = 5; - optional string method = 6; - optional google.protobuf.Timestamp startedAt = 7; -} - -message PaymentCompleted { - string paymentId = 1; - string status = 2; - int64 amount = 3; - string currency = 4; - optional string processorReference = 5; - optional google.protobuf.Timestamp completedAt = 6; -} - -message PaymentDeclined { - string paymentId = 1; - string message = 2; - optional string code = 3; -} - -message PaymentEvent { - string paymentId = 1; - string name = 2; - bool success = 3; - google.protobuf.Any data = 4; -} - -message ConfirmationViewed { - google.protobuf.Timestamp viewedAt = 1; -} - -message CreateCheckoutOrder { - string terms = 1; - string checkout = 2; - string confirmation = 3; - string push = 4; - string validation = 5; - string country = 6; -} - -message OrderCreated { - string orderId = 1; - string status = 2; -} - -message Noop { - // Intentionally empty - used for ownership acquisition or health pings -} - -message InitializeCheckout { - string orderId = 1; - string status = 2; - bool paymentInProgress = 3; -} - -message InventoryReserved { - string id = 1; - string status = 2; - optional string message = 3; -} - -message AddVoucher { - string code = 1; - int64 value = 2; - repeated string voucherRules = 3; - string description = 4; -} - -message RemoveVoucher { uint32 id = 1; } - -message UpsertSubscriptionDetails { - optional string id = 1; - string offeringCode = 2; - string signingType = 3; - google.protobuf.Any data = 4; -} - -message PreConditionFailed { - string operation = 1; - string error = 2; - google.protobuf.Any input = 3; -} - -message GiftcardItem { - int64 value = 1; - string deliveryDate = 2; - string recipient = 3; - string recipientType = 4; - string message = 5; - optional google.protobuf.Any designConfig = 6; -} - -message AddGiftcard { - GiftcardItem giftcard = 1; -} - -message RemoveGiftcard { - uint32 id = 1; -} - -message Mutation { - oneof type { - ClearCartRequest clear_cart = 1; - AddItem add_item = 2; - RemoveItem remove_item = 3; - ChangeQuantity change_quantity = 4; - SetDelivery set_delivery = 5; - SetPickupPoint set_pickup_point = 6; - RemoveDelivery remove_delivery = 7; - SetUserId set_user_id = 8; - LineItemMarking line_item_marking = 9; - RemoveLineItemMarking remove_line_item_marking = 10; - SubscriptionAdded subscription_added = 11; - PaymentDeclined payment_declined = 12; - ConfirmationViewed confirmation_viewed = 13; - CreateCheckoutOrder create_checkout_order = 14; - OrderCreated order_created = 15; - Noop noop = 16; - InitializeCheckout initialize_checkout = 17; - InventoryReserved inventory_reserved = 18; - AddVoucher add_voucher = 19; - RemoveVoucher remove_voucher = 20; - UpsertSubscriptionDetails upsert_subscription_details = 21; - PreConditionFailed pre_condition_failed = 22; - AddGiftcard add_giftcard = 23; - RemoveGiftcard remove_giftcard = 24; - PaymentStarted payment_started = 25; - PaymentCompleted payment_completed = 26; - PaymentEvent payment_event = 27; - } -}