diff --git a/README.md b/README.md index 99c7889..45973d5 100644 --- a/README.md +++ b/README.md @@ -1 +1,80 @@ -protoc --proto_path=proto --go_out=out --go_opt=paths=source_relative proto/messages.proto \ No newline at end of file +# Go Cart Actor + +A distributed cart management system using the actor model pattern. + +## Prerequisites + +- Go 1.24.2+ +- Protocol Buffers compiler (`protoc`) +- protoc-gen-go plugin + +### Installing Protocol Buffers + +On Windows: +```powershell +winget install protobuf +``` + +On macOS: +```bash +brew install protobuf +``` + +On Linux: +```bash +# Ubuntu/Debian +sudo apt install protobuf-compiler + +# Or download from: https://github.com/protocolbuffers/protobuf/releases +``` + +### Installing Go protobuf plugin + +```bash +go install google.golang.org/protobuf/cmd/protoc-gen-go@latest +``` + +## Working with Protocol Buffers + +### Generating Go code from proto files + +After modifying `proto/messages.proto`, regenerate the Go code: + +```bash +cd proto +protoc --go_out=. --go_opt=paths=source_relative messages.proto +``` + +### Protocol Buffer Messages + +The `proto/messages.proto` file defines the following message types: + +- `AddRequest` - Add items to cart (includes quantity, sku, country, optional storeId) +- `SetCartRequest` - Set entire cart contents +- `AddItem` - Complete item information for cart +- `RemoveItem` - Remove item from cart +- `ChangeQuantity` - Update item quantity +- `SetDelivery` - Configure delivery options +- `SetPickupPoint` - Set pickup location +- `PickupPoint` - Pickup point details +- `RemoveDelivery` - Remove delivery option +- `CreateCheckoutOrder` - Initiate checkout +- `OrderCreated` - Order creation response + +### Building the project + +```bash +go build . +``` + +### Running tests + +```bash +go test ./... +``` + +## Important Notes + +- Always regenerate protobuf Go code after modifying `.proto` files +- The generated `messages.pb.go` file should not be edited manually +- Make sure your PATH includes the protoc-gen-go binary location (usually `$GOPATH/bin`) \ No newline at end of file diff --git a/cart-grain.go b/cart-grain.go index bb231fa..6541917 100644 --- a/cart-grain.go +++ b/cart-grain.go @@ -127,8 +127,8 @@ func getInt(data interface{}) (int, error) { } } -func getItemData(sku string, qty int) (*messages.AddItem, error) { - item, err := FetchItem(sku) +func getItemData(sku string, qty int, country string) (*messages.AddItem, error) { + item, err := FetchItem(sku, country) if err != nil { return nil, err } @@ -162,11 +162,6 @@ func getItemData(sku string, qty int) (*messages.AddItem, error) { category4, _ := item.Fields[13].(string) category5, _ := item.Fields[14].(string) - // is own - if sellerName == "Elgiganten" { - sellerName = "" - } - return &messages.AddItem{ ItemId: int64(item.Id), Quantity: int32(qty), @@ -187,12 +182,13 @@ func getItemData(sku string, qty int) (*messages.AddItem, error) { SellerName: sellerName, ArticleType: articleType, Disclaimer: item.Disclaimer, + Country: country, Outlet: outlet, }, nil } -func (c *CartGrain) AddItem(sku string, qty int) (*FrameWithPayload, error) { - cartItem, err := getItemData(sku, qty) +func (c *CartGrain) AddItem(sku string, qty int, country string) (*FrameWithPayload, error) { + cartItem, err := getItemData(sku, qty, country) if err != nil { return nil, err } @@ -286,7 +282,7 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa c.Items = make([]*CartItem, 0, len(msg.Items)) c.mu.Unlock() for _, item := range msg.Items { - c.AddItem(item.Sku, int(item.Quantity)) + c.AddItem(item.Sku, int(item.Quantity), item.Country) } } @@ -301,7 +297,7 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa existingItem.Quantity += int(msg.Quantity) c.UpdateTotals() } else { - return c.AddItem(msg.Sku, int(msg.Quantity)) // extent AddRequest to include quantity + return c.AddItem(msg.Sku, int(msg.Quantity), msg.Country) } } diff --git a/deployment/deployment.yaml b/deployment/deployment.yaml index 272f61f..a2eb933 100644 --- a/deployment/deployment.yaml +++ b/deployment/deployment.yaml @@ -15,7 +15,7 @@ metadata: arch: amd64 name: cart-actor-x86 spec: - replicas: 3 + replicas: 0 selector: matchLabels: app: cart-actor @@ -102,6 +102,8 @@ spec: fieldPath: status.podIP - name: AMQP_URL value: "amqp://admin:12bananer@rabbitmq.dev:5672/" + # - name: BASE_URL + # value: "https://s10n-no.tornberg.me" - name: POD_NAME valueFrom: fieldRef: @@ -206,6 +208,8 @@ spec: fieldPath: status.podIP - name: AMQP_URL value: "amqp://admin:12bananer@rabbitmq.dev:5672/" + # - name: BASE_URL + # value: "https://s10n-no.tornberg.me" - name: POD_NAME valueFrom: fieldRef: diff --git a/product-fetcher.go b/product-fetcher.go index 3cf3788..01d5a79 100644 --- a/product-fetcher.go +++ b/product-fetcher.go @@ -4,23 +4,23 @@ import ( "encoding/json" "fmt" "net/http" - "os" "github.com/matst80/slask-finder/pkg/index" ) -/** end */ -var baseUrl string - -func init() { - baseUrl = "https://slask-finder.tornberg.me" - envUrl := os.Getenv("BASE_URL") - if envUrl != "" { - baseUrl = envUrl +// TODO make this configurable +func getBaseUrl(country string) string { + // if country == "se" { + // return "http://s10n-se:8080" + // } + if country == "no" { + return "http://s10n-no:8080" } + return "https://slask-finder.tornberg.me" } -func FetchItem(sku string) (*index.DataItem, error) { +func FetchItem(sku string, country string) (*index.DataItem, error) { + baseUrl := getBaseUrl(country) res, err := http.Get(fmt.Sprintf("%s/api/by-sku/%s", baseUrl, sku)) if err != nil { return nil, err diff --git a/proto/messages.pb.go b/proto/messages.pb.go index b04b575..3eae671 100644 --- a/proto/messages.pb.go +++ b/proto/messages.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.5 -// protoc v5.29.3 +// protoc-gen-go v1.36.9 +// protoc v6.32.1 // source: messages.proto package messages @@ -25,6 +25,8 @@ type AddRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Quantity int32 `protobuf:"varint,1,opt,name=quantity,proto3" json:"quantity,omitempty"` Sku string `protobuf:"bytes,2,opt,name=sku,proto3" json:"sku,omitempty"` + Country string `protobuf:"bytes,3,opt,name=country,proto3" json:"country,omitempty"` + StoreId *string `protobuf:"bytes,4,opt,name=storeId,proto3,oneof" json:"storeId,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -73,6 +75,20 @@ func (x *AddRequest) GetSku() string { return "" } +func (x *AddRequest) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + +func (x *AddRequest) GetStoreId() string { + if x != nil && x.StoreId != nil { + return *x.StoreId + } + return "" +} + type SetCartRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Items []*AddRequest `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` @@ -138,6 +154,7 @@ type AddItem struct { 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"` Outlet *string `protobuf:"bytes,12,opt,name=outlet,proto3,oneof" json:"outlet,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -306,6 +323,13 @@ func (x *AddItem) GetSellerName() string { return "" } +func (x *AddItem) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + func (x *AddItem) GetOutlet() string { if x != nil && x.Outlet != nil { return *x.Outlet @@ -851,122 +875,110 @@ func (x *OrderCreated) GetStatus() string { 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, 0x22, 0x3a, 0x0a, 0x0a, 0x41, 0x64, - 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x6b, 0x75, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x73, 0x6b, 0x75, 0x22, 0x3c, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x43, 0x61, 0x72, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x05, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x22, 0xa4, 0x04, 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, - 0x03, 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, 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, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x75, 0x74, 0x6c, 0x65, 0x74, 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, 0x03, 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, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 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, 0x03, 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, 0x03, 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, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x9f, 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, 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, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, - 0x3b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -}) +const file_messages_proto_rawDesc = "" + + "\n" + + "\x0emessages.proto\x12\bmessages\"\x7f\n" + + "\n" + + "AddRequest\x12\x1a\n" + + "\bquantity\x18\x01 \x01(\x05R\bquantity\x12\x10\n" + + "\x03sku\x18\x02 \x01(\tR\x03sku\x12\x18\n" + + "\acountry\x18\x03 \x01(\tR\acountry\x12\x1d\n" + + "\astoreId\x18\x04 \x01(\tH\x00R\astoreId\x88\x01\x01B\n" + + "\n" + + "\b_storeId\"<\n" + + "\x0eSetCartRequest\x12*\n" + + "\x05items\x18\x01 \x03(\v2\x14.messages.AddRequestR\x05items\"\xbe\x04\n" + + "\aAddItem\x12\x17\n" + + "\aitem_id\x18\x01 \x01(\x03R\x06itemId\x12\x1a\n" + + "\bquantity\x18\x02 \x01(\x05R\bquantity\x12\x14\n" + + "\x05price\x18\x03 \x01(\x03R\x05price\x12\x1a\n" + + "\borgPrice\x18\t \x01(\x03R\borgPrice\x12\x10\n" + + "\x03sku\x18\x04 \x01(\tR\x03sku\x12\x12\n" + + "\x04name\x18\x05 \x01(\tR\x04name\x12\x14\n" + + "\x05image\x18\x06 \x01(\tR\x05image\x12\x14\n" + + "\x05stock\x18\a \x01(\x05R\x05stock\x12\x10\n" + + "\x03tax\x18\b \x01(\x05R\x03tax\x12\x14\n" + + "\x05brand\x18\r \x01(\tR\x05brand\x12\x1a\n" + + "\bcategory\x18\x0e \x01(\tR\bcategory\x12\x1c\n" + + "\tcategory2\x18\x0f \x01(\tR\tcategory2\x12\x1c\n" + + "\tcategory3\x18\x10 \x01(\tR\tcategory3\x12\x1c\n" + + "\tcategory4\x18\x11 \x01(\tR\tcategory4\x12\x1c\n" + + "\tcategory5\x18\x12 \x01(\tR\tcategory5\x12\x1e\n" + + "\n" + + "disclaimer\x18\n" + + " \x01(\tR\n" + + "disclaimer\x12 \n" + + "\varticleType\x18\v \x01(\tR\varticleType\x12\x1a\n" + + "\bsellerId\x18\x13 \x01(\tR\bsellerId\x12\x1e\n" + + "\n" + + "sellerName\x18\x14 \x01(\tR\n" + + "sellerName\x12\x18\n" + + "\acountry\x18\x15 \x01(\tR\acountry\x12\x1b\n" + + "\x06outlet\x18\f \x01(\tH\x00R\x06outlet\x88\x01\x01B\t\n" + + "\a_outlet\"\x1c\n" + + "\n" + + "RemoveItem\x12\x0e\n" + + "\x02Id\x18\x01 \x01(\x03R\x02Id\"<\n" + + "\x0eChangeQuantity\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" + + "\bquantity\x18\x02 \x01(\x05R\bquantity\"\x86\x02\n" + + "\vSetDelivery\x12\x1a\n" + + "\bprovider\x18\x01 \x01(\tR\bprovider\x12\x14\n" + + "\x05items\x18\x02 \x03(\x03R\x05items\x12<\n" + + "\vpickupPoint\x18\x03 \x01(\v2\x15.messages.PickupPointH\x00R\vpickupPoint\x88\x01\x01\x12\x18\n" + + "\acountry\x18\x04 \x01(\tR\acountry\x12\x10\n" + + "\x03zip\x18\x05 \x01(\tR\x03zip\x12\x1d\n" + + "\aaddress\x18\x06 \x01(\tH\x01R\aaddress\x88\x01\x01\x12\x17\n" + + "\x04city\x18\a \x01(\tH\x02R\x04city\x88\x01\x01B\x0e\n" + + "\f_pickupPointB\n" + + "\n" + + "\b_addressB\a\n" + + "\x05_city\"\xf9\x01\n" + + "\x0eSetPickupPoint\x12\x1e\n" + + "\n" + + "deliveryId\x18\x01 \x01(\x03R\n" + + "deliveryId\x12\x0e\n" + + "\x02id\x18\x02 \x01(\tR\x02id\x12\x17\n" + + "\x04name\x18\x03 \x01(\tH\x00R\x04name\x88\x01\x01\x12\x1d\n" + + "\aaddress\x18\x04 \x01(\tH\x01R\aaddress\x88\x01\x01\x12\x17\n" + + "\x04city\x18\x05 \x01(\tH\x02R\x04city\x88\x01\x01\x12\x15\n" + + "\x03zip\x18\x06 \x01(\tH\x03R\x03zip\x88\x01\x01\x12\x1d\n" + + "\acountry\x18\a \x01(\tH\x04R\acountry\x88\x01\x01B\a\n" + + "\x05_nameB\n" + + "\n" + + "\b_addressB\a\n" + + "\x05_cityB\x06\n" + + "\x04_zipB\n" + + "\n" + + "\b_country\"\xd6\x01\n" + + "\vPickupPoint\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x17\n" + + "\x04name\x18\x02 \x01(\tH\x00R\x04name\x88\x01\x01\x12\x1d\n" + + "\aaddress\x18\x03 \x01(\tH\x01R\aaddress\x88\x01\x01\x12\x17\n" + + "\x04city\x18\x04 \x01(\tH\x02R\x04city\x88\x01\x01\x12\x15\n" + + "\x03zip\x18\x05 \x01(\tH\x03R\x03zip\x88\x01\x01\x12\x1d\n" + + "\acountry\x18\x06 \x01(\tH\x04R\acountry\x88\x01\x01B\a\n" + + "\x05_nameB\n" + + "\n" + + "\b_addressB\a\n" + + "\x05_cityB\x06\n" + + "\x04_zipB\n" + + "\n" + + "\b_country\" \n" + + "\x0eRemoveDelivery\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\"\x9f\x01\n" + + "\x13CreateCheckoutOrder\x12\x14\n" + + "\x05terms\x18\x01 \x01(\tR\x05terms\x12\x1a\n" + + "\bcheckout\x18\x02 \x01(\tR\bcheckout\x12\"\n" + + "\fconfirmation\x18\x03 \x01(\tR\fconfirmation\x12\x12\n" + + "\x04push\x18\x04 \x01(\tR\x04push\x12\x1e\n" + + "\n" + + "validation\x18\x05 \x01(\tR\n" + + "validation\"@\n" + + "\fOrderCreated\x12\x18\n" + + "\aorderId\x18\x01 \x01(\tR\aorderId\x12\x16\n" + + "\x06status\x18\x02 \x01(\tR\x06statusB\fZ\n" + + ".;messagesb\x06proto3" var ( file_messages_proto_rawDescOnce sync.Once @@ -1009,6 +1021,7 @@ func file_messages_proto_init() { if File_messages_proto != nil { return } + file_messages_proto_msgTypes[0].OneofWrappers = []any{} file_messages_proto_msgTypes[2].OneofWrappers = []any{} file_messages_proto_msgTypes[5].OneofWrappers = []any{} file_messages_proto_msgTypes[6].OneofWrappers = []any{} diff --git a/proto/messages.proto b/proto/messages.proto index 6d102e0..ccf3a3b 100644 --- a/proto/messages.proto +++ b/proto/messages.proto @@ -5,6 +5,8 @@ option go_package = ".;messages"; message AddRequest { int32 quantity = 1; string sku = 2; + string country = 3; + optional string storeId = 4; } message SetCartRequest { @@ -31,6 +33,7 @@ message AddItem { string articleType = 11; string sellerId = 19; string sellerName = 20; + string country = 21; optional string outlet = 12; }