more features
This commit is contained in:
107
cart-grain.go
107
cart-grain.go
@@ -35,23 +35,27 @@ const (
|
||||
)
|
||||
|
||||
type CartItem struct {
|
||||
Id int `json:"id"`
|
||||
ParentId int `json:"parentId,omitempty"`
|
||||
Sku string `json:"sku"`
|
||||
Name string `json:"name"`
|
||||
Price int64 `json:"price"`
|
||||
OrgPrice int64 `json:"orgPrice"`
|
||||
Stock StockStatus `json:"stock"`
|
||||
Quantity int `json:"qty"`
|
||||
Tax int `json:"tax"`
|
||||
Disclaimer string `json:"disclaimer,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
Id int `json:"id"`
|
||||
ParentId int `json:"parentId,omitempty"`
|
||||
Sku string `json:"sku"`
|
||||
Name string `json:"name"`
|
||||
Price int64 `json:"price"`
|
||||
OrgPrice int64 `json:"orgPrice"`
|
||||
Stock StockStatus `json:"stock"`
|
||||
Quantity int `json:"qty"`
|
||||
Tax int `json:"tax"`
|
||||
Disclaimer string `json:"disclaimer,omitempty"`
|
||||
ArticleType string `json:"type,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
Outlet string `json:"outlet,omitempty"`
|
||||
}
|
||||
|
||||
type CartDelivery struct {
|
||||
Provider string `json:"provider"`
|
||||
Price int64 `json:"price"`
|
||||
Items []int `json:"items"`
|
||||
Id int `json:"id"`
|
||||
Provider string `json:"provider"`
|
||||
Price int64 `json:"price"`
|
||||
Items []int `json:"items"`
|
||||
PickupPoint *messages.PickupPoint `json:"pickupPoint,omitempty"`
|
||||
}
|
||||
|
||||
type CartGrain struct {
|
||||
@@ -59,10 +63,10 @@ type CartGrain struct {
|
||||
lastItemId int
|
||||
lastDeliveryId int
|
||||
storageMessages []Message
|
||||
Id CartId `json:"id"`
|
||||
Items []*CartItem `json:"items"`
|
||||
TotalPrice int64 `json:"totalPrice"`
|
||||
Deliveries []CartDelivery `json:"deliveries,omitempty"`
|
||||
Id CartId `json:"id"`
|
||||
Items []*CartItem `json:"items"`
|
||||
TotalPrice int64 `json:"totalPrice"`
|
||||
Deliveries []*CartDelivery `json:"deliveries,omitempty"`
|
||||
}
|
||||
|
||||
type Grain interface {
|
||||
@@ -108,9 +112,9 @@ func getItemData(sku string, qty int) (*messages.AddItem, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
orgPrice, _ := getInt(item.Fields[6])
|
||||
orgPrice, _ := getInt(item.Fields[5])
|
||||
|
||||
price, priceErr := getInt(item.Fields[5])
|
||||
price, priceErr := getInt(item.Fields[4])
|
||||
|
||||
if priceErr != nil {
|
||||
return nil, fmt.Errorf("invalid price")
|
||||
@@ -122,17 +126,25 @@ func getItemData(sku string, qty int) (*messages.AddItem, error) {
|
||||
} else if item.StockLevel == "5+" {
|
||||
stock = LowStock
|
||||
}
|
||||
articleType, _ := item.Fields[1].(string)
|
||||
outletGrade, ok := item.Fields[20].(string)
|
||||
var outlet *string
|
||||
if ok {
|
||||
outlet = &outletGrade
|
||||
}
|
||||
|
||||
return &messages.AddItem{
|
||||
Quantity: int32(qty),
|
||||
Price: int64(price),
|
||||
OrgPrice: int64(orgPrice),
|
||||
Sku: sku,
|
||||
Name: item.Title,
|
||||
Image: item.Img,
|
||||
Stock: int32(stock),
|
||||
Tax: 2500,
|
||||
Disclaimer: item.Disclaimer,
|
||||
Quantity: int32(qty),
|
||||
Price: int64(price),
|
||||
OrgPrice: int64(orgPrice),
|
||||
Sku: sku,
|
||||
Name: item.Title,
|
||||
Image: item.Img,
|
||||
Stock: int32(stock),
|
||||
Tax: 2500,
|
||||
ArticleType: articleType,
|
||||
Disclaimer: item.Disclaimer,
|
||||
Outlet: outlet,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -321,13 +333,48 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
|
||||
}
|
||||
}
|
||||
}
|
||||
c.Deliveries = append(c.Deliveries, CartDelivery{
|
||||
c.Deliveries = append(c.Deliveries, &CartDelivery{
|
||||
Id: c.lastDeliveryId,
|
||||
Provider: msg.Provider,
|
||||
Price: 49,
|
||||
Items: items,
|
||||
})
|
||||
}
|
||||
case RemoveDeliveryType:
|
||||
msg, ok := message.Content.(*messages.RemoveDelivery)
|
||||
if !ok {
|
||||
err = fmt.Errorf("expected RemoveDelivery")
|
||||
} else {
|
||||
deliveries := make([]*CartDelivery, 0, len(c.Deliveries))
|
||||
for _, delivery := range c.Deliveries {
|
||||
if delivery.Id == int(msg.Id) {
|
||||
c.TotalPrice -= delivery.Price
|
||||
} else {
|
||||
deliveries = append(deliveries, delivery)
|
||||
}
|
||||
}
|
||||
c.Deliveries = deliveries
|
||||
}
|
||||
case SetPickupPointType:
|
||||
msg, ok := message.Content.(*messages.SetPickupPoint)
|
||||
if !ok {
|
||||
err = fmt.Errorf("expected SetPickupPoint")
|
||||
} else {
|
||||
for _, delivery := range c.Deliveries {
|
||||
if delivery.Id == int(msg.DeliveryId) {
|
||||
delivery.PickupPoint = &messages.PickupPoint{
|
||||
Id: msg.Id,
|
||||
Address: msg.Address,
|
||||
City: msg.City,
|
||||
Zip: msg.Zip,
|
||||
Country: msg.Country,
|
||||
Name: msg.Name,
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
default:
|
||||
err = fmt.Errorf("unknown message type %d", message.Type)
|
||||
}
|
||||
|
||||
2
main.go
2
main.go
@@ -37,7 +37,7 @@ func spawn(id CartId) (*CartGrain, error) {
|
||||
ret := &CartGrain{
|
||||
lastItemId: 0,
|
||||
lastDeliveryId: 0,
|
||||
Deliveries: []CartDelivery{},
|
||||
Deliveries: []*CartDelivery{},
|
||||
Id: id,
|
||||
Items: []*CartItem{},
|
||||
storageMessages: []Message{},
|
||||
|
||||
@@ -8,4 +8,5 @@ const (
|
||||
RemoveDeliveryType = 5
|
||||
ChangeQuantityType = 6
|
||||
SetDeliveryType = 7
|
||||
SetPickupPointType = 8
|
||||
)
|
||||
|
||||
@@ -78,15 +78,17 @@ type AddItem struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
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"`
|
||||
Disclaimer string `protobuf:"bytes,10,opt,name=Disclaimer,proto3" json:"Disclaimer,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"`
|
||||
Disclaimer string `protobuf:"bytes,10,opt,name=Disclaimer,proto3" json:"Disclaimer,omitempty"`
|
||||
ArticleType string `protobuf:"bytes,11,opt,name=ArticleType,proto3" json:"ArticleType,omitempty"`
|
||||
Outlet *string `protobuf:"bytes,12,opt,name=Outlet,proto3,oneof" json:"Outlet,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AddItem) Reset() {
|
||||
@@ -182,6 +184,20 @@ func (x *AddItem) GetDisclaimer() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddItem) GetArticleType() string {
|
||||
if x != nil {
|
||||
return x.ArticleType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddItem) GetOutlet() string {
|
||||
if x != nil && x.Outlet != nil {
|
||||
return *x.Outlet
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type RemoveItem struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -285,8 +301,9 @@ type SetDelivery struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Provider string `protobuf:"bytes,1,opt,name=Provider,proto3" json:"Provider,omitempty"`
|
||||
Items []int64 `protobuf:"varint,2,rep,packed,name=Items,proto3" json:"Items,omitempty"`
|
||||
Provider string `protobuf:"bytes,1,opt,name=Provider,proto3" json:"Provider,omitempty"`
|
||||
Items []int64 `protobuf:"varint,2,rep,packed,name=Items,proto3" json:"Items,omitempty"`
|
||||
PickupPoint *PickupPoint `protobuf:"bytes,3,opt,name=PickupPoint,proto3,oneof" json:"PickupPoint,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SetDelivery) Reset() {
|
||||
@@ -333,6 +350,191 @@ func (x *SetDelivery) GetItems() []int64 {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SetDelivery) GetPickupPoint() *PickupPoint {
|
||||
if x != nil {
|
||||
return x.PickupPoint
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SetPickupPoint struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
DeliveryId int64 `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"`
|
||||
}
|
||||
|
||||
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() int64 {
|
||||
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
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
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
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -343,7 +545,7 @@ type RemoveDelivery struct {
|
||||
|
||||
func (x *RemoveDelivery) Reset() {
|
||||
*x = RemoveDelivery{}
|
||||
mi := &file_messages_proto_msgTypes[5]
|
||||
mi := &file_messages_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -355,7 +557,7 @@ func (x *RemoveDelivery) String() string {
|
||||
func (*RemoveDelivery) ProtoMessage() {}
|
||||
|
||||
func (x *RemoveDelivery) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_messages_proto_msgTypes[5]
|
||||
mi := &file_messages_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -368,7 +570,7 @@ func (x *RemoveDelivery) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use RemoveDelivery.ProtoReflect.Descriptor instead.
|
||||
func (*RemoveDelivery) Descriptor() ([]byte, []int) {
|
||||
return file_messages_proto_rawDescGZIP(), []int{5}
|
||||
return file_messages_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *RemoveDelivery) GetId() int64 {
|
||||
@@ -386,7 +588,7 @@ var file_messages_proto_rawDesc = []byte{
|
||||
0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x51, 0x75, 0x61, 0x6e,
|
||||
0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x51, 0x75, 0x61, 0x6e,
|
||||
0x74, 0x69, 0x74, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x53, 0x6b, 0x75, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x03, 0x53, 0x6b, 0x75, 0x22, 0xdb, 0x01, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x49, 0x74,
|
||||
0x09, 0x52, 0x03, 0x53, 0x6b, 0x75, 0x22, 0xa5, 0x02, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x49, 0x74,
|
||||
0x65, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x50,
|
||||
@@ -400,20 +602,59 @@ var file_messages_proto_rawDesc = []byte{
|
||||
0x63, 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x54, 0x61, 0x78, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x03, 0x54, 0x61, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x44, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d,
|
||||
0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x44, 0x69, 0x73, 0x63, 0x6c, 0x61,
|
||||
0x69, 0x6d, 0x65, 0x72, 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, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x02, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79,
|
||||
0x22, 0x3f, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12,
|
||||
0x1a, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x49,
|
||||
0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d,
|
||||
0x73, 0x22, 0x20, 0x0a, 0x0e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x69, 0x76,
|
||||
0x65, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x02, 0x49, 0x64, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x69, 0x6d, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x54,
|
||||
0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x72, 0x74, 0x69, 0x63,
|
||||
0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x06, 0x4f, 0x75, 0x74, 0x6c, 0x65, 0x74,
|
||||
0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x4f, 0x75, 0x74, 0x6c, 0x65, 0x74,
|
||||
0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x4f, 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, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x08, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x22, 0x8d, 0x01, 0x0a, 0x0b, 0x53,
|
||||
0x65, 0x74, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x72,
|
||||
0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x72,
|
||||
0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18,
|
||||
0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x3c, 0x0a, 0x0b,
|
||||
0x50, 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, 0x50, 0x69, 0x63, 0x6b,
|
||||
0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x50,
|
||||
0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x22, 0xf9, 0x01, 0x0a, 0x0e, 0x53,
|
||||
0x65, 0x74, 0x50, 0x69, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1e, 0x0a,
|
||||
0x0a, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x0a, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x17, 0x0a,
|
||||
0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x4e,
|
||||
0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
|
||||
0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65,
|
||||
0x73, 0x73, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x43, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x04, 0x43, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, 0x15,
|
||||
0x0a, 0x03, 0x5a, 0x69, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x03, 0x5a,
|
||||
0x69, 0x70, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, 0x52, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72,
|
||||
0x79, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x0a, 0x0a,
|
||||
0x08, 0x5f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x43, 0x69,
|
||||
0x74, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x5a, 0x69, 0x70, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x43,
|
||||
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, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12,
|
||||
0x1d, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x48, 0x01, 0x52, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x88, 0x01, 0x01, 0x12, 0x17,
|
||||
0x0a, 0x04, 0x43, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x04,
|
||||
0x43, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x5a, 0x69, 0x70, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x03, 0x5a, 0x69, 0x70, 0x88, 0x01, 0x01, 0x12, 0x1d,
|
||||
0x0a, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48,
|
||||
0x04, 0x52, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a,
|
||||
0x05, 0x5f, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x41, 0x64, 0x64, 0x72, 0x65,
|
||||
0x73, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x43, 0x69, 0x74, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x5f,
|
||||
0x5a, 0x69, 0x70, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x43, 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, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49,
|
||||
0x64, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -428,21 +669,24 @@ func file_messages_proto_rawDescGZIP() []byte {
|
||||
return file_messages_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_messages_proto_goTypes = []any{
|
||||
(*AddRequest)(nil), // 0: messages.AddRequest
|
||||
(*AddItem)(nil), // 1: messages.AddItem
|
||||
(*RemoveItem)(nil), // 2: messages.RemoveItem
|
||||
(*ChangeQuantity)(nil), // 3: messages.ChangeQuantity
|
||||
(*SetDelivery)(nil), // 4: messages.SetDelivery
|
||||
(*RemoveDelivery)(nil), // 5: messages.RemoveDelivery
|
||||
(*SetPickupPoint)(nil), // 5: messages.SetPickupPoint
|
||||
(*PickupPoint)(nil), // 6: messages.PickupPoint
|
||||
(*RemoveDelivery)(nil), // 7: messages.RemoveDelivery
|
||||
}
|
||||
var file_messages_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
6, // 0: messages.SetDelivery.PickupPoint:type_name -> messages.PickupPoint
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_messages_proto_init() }
|
||||
@@ -450,13 +694,17 @@ 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{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_messages_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -17,6 +17,8 @@ message AddItem {
|
||||
int32 Stock = 7;
|
||||
int32 Tax = 8;
|
||||
string Disclaimer = 10;
|
||||
string ArticleType = 11;
|
||||
optional string Outlet = 12;
|
||||
}
|
||||
|
||||
message RemoveItem {
|
||||
@@ -31,6 +33,30 @@ message ChangeQuantity {
|
||||
message SetDelivery {
|
||||
string Provider = 1;
|
||||
repeated int64 Items = 2;
|
||||
optional PickupPoint PickupPoint = 3;
|
||||
string Country = 4;
|
||||
string Zip = 5;
|
||||
optional string Address = 6;
|
||||
optional string City = 7;
|
||||
}
|
||||
|
||||
message SetPickupPoint {
|
||||
int64 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 {
|
||||
|
||||
Reference in New Issue
Block a user