diff --git a/cart_state_mapper.go b/cart_state_mapper.go index 7a76c12..1043f51 100644 --- a/cart_state_mapper.go +++ b/cart_state_mapper.go @@ -32,11 +32,11 @@ func ToCartState(c *CartGrain) *messages.CartState { items = append(items, &messages.CartItemState{ Id: int64(it.Id), - SourceItemId: int64(it.ItemId), + ItemId: int64(it.ItemId), Sku: it.Sku, Name: it.Name, - UnitPrice: it.Price, - Quantity: int32(it.Quantity), + Price: it.Price, + Qty: int32(it.Quantity), TotalPrice: it.TotalPrice, TotalTax: it.TotalTax, OrgPrice: it.OrgPrice, @@ -49,7 +49,7 @@ func ToCartState(c *CartGrain) *messages.CartState { Category4: it.Category4, Category5: it.Category5, Image: it.Image, - ArticleType: it.ArticleType, + Type: it.ArticleType, SellerId: it.SellerId, SellerName: it.SellerName, Disclaimer: it.Disclaimer, @@ -84,13 +84,13 @@ func ToCartState(c *CartGrain) *messages.CartState { Id: int64(d.Id), Provider: d.Provider, Price: d.Price, - ItemIds: itemIds, + Items: itemIds, PickupPoint: pp, }) } return &messages.CartState{ - CartId: c.Id.String(), + Id: c.Id.String(), Items: items, TotalPrice: c.TotalPrice, TotalTax: c.TotalTax, @@ -111,7 +111,7 @@ func FromCartState(cs *messages.CartState, g *CartGrain) *CartGrain { if g == nil { g = &CartGrain{} } - g.Id = ToCartId(cs.CartId) + g.Id = ToCartId(cs.Id) g.TotalPrice = cs.TotalPrice g.TotalTax = cs.TotalTax g.TotalDiscount = cs.TotalDiscount @@ -129,11 +129,11 @@ func FromCartState(cs *messages.CartState, g *CartGrain) *CartGrain { storeId := toPtr(it.StoreId) g.Items = append(g.Items, &CartItem{ Id: int(it.Id), - ItemId: int(it.SourceItemId), + ItemId: int(it.ItemId), Sku: it.Sku, Name: it.Name, - Price: it.UnitPrice, - Quantity: int(it.Quantity), + Price: it.Price, + Quantity: int(it.Qty), TotalPrice: it.TotalPrice, TotalTax: it.TotalTax, OrgPrice: it.OrgPrice, @@ -145,7 +145,7 @@ func FromCartState(cs *messages.CartState, g *CartGrain) *CartGrain { Category4: it.Category4, Category5: it.Category5, Image: it.Image, - ArticleType: it.ArticleType, + ArticleType: it.Type, SellerId: it.SellerId, SellerName: it.SellerName, Disclaimer: it.Disclaimer, @@ -165,8 +165,9 @@ func FromCartState(cs *messages.CartState, g *CartGrain) *CartGrain { if d == nil { continue } - intIds := make([]int, 0, len(d.ItemIds)) - for _, id := range d.ItemIds { + + intIds := make([]int, 0, len(d.Items)) + for _, id := range d.Items { intIds = append(intIds, int(id)) } var pp *messages.PickupPoint diff --git a/proto/cart_actor.pb.go b/proto/cart_actor.pb.go index c3c5249..6392815 100644 --- a/proto/cart_actor.pb.go +++ b/proto/cart_actor.pb.go @@ -855,20 +855,19 @@ func (x *OrderCompletedRequest) GetPayload() *OrderCreated { return nil } -// ----------------------------------------------------------------------------- -// Cart state snapshot (unchanged from v1 except envelope removal context) -// ----------------------------------------------------------------------------- +// Excerpt: updated messages for camelCase JSON output type CartState struct { state protoimpl.MessageState `protogen:"open.v1"` - CartId string `protobuf:"bytes,1,opt,name=cart_id,json=cartId,proto3" json:"cart_id,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // was cart_id Items []*CartItemState `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` - TotalPrice int64 `protobuf:"varint,3,opt,name=total_price,json=totalPrice,proto3" json:"total_price,omitempty"` - TotalTax int64 `protobuf:"varint,4,opt,name=total_tax,json=totalTax,proto3" json:"total_tax,omitempty"` - TotalDiscount int64 `protobuf:"varint,5,opt,name=total_discount,json=totalDiscount,proto3" json:"total_discount,omitempty"` + TotalPrice int64 `protobuf:"varint,3,opt,name=totalPrice,proto3" json:"totalPrice,omitempty"` // was total_price + TotalTax int64 `protobuf:"varint,4,opt,name=totalTax,proto3" json:"totalTax,omitempty"` // was total_tax + TotalDiscount int64 `protobuf:"varint,5,opt,name=totalDiscount,proto3" json:"totalDiscount,omitempty"` // was total_discount Deliveries []*DeliveryState `protobuf:"bytes,6,rep,name=deliveries,proto3" json:"deliveries,omitempty"` - PaymentInProgress bool `protobuf:"varint,7,opt,name=payment_in_progress,json=paymentInProgress,proto3" json:"payment_in_progress,omitempty"` - OrderReference string `protobuf:"bytes,8,opt,name=order_reference,json=orderReference,proto3" json:"order_reference,omitempty"` - PaymentStatus string `protobuf:"bytes,9,opt,name=payment_status,json=paymentStatus,proto3" json:"payment_status,omitempty"` + PaymentInProgress bool `protobuf:"varint,7,opt,name=paymentInProgress,proto3" json:"paymentInProgress,omitempty"` // was payment_in_progress + OrderReference string `protobuf:"bytes,8,opt,name=orderReference,proto3" json:"orderReference,omitempty"` // was order_reference + PaymentStatus string `protobuf:"bytes,9,opt,name=paymentStatus,proto3" json:"paymentStatus,omitempty"` // was payment_status + Processing bool `protobuf:"varint,10,opt,name=processing,proto3" json:"processing,omitempty"` // NEW (mirrors legacy CartGrain.processing) unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -903,9 +902,9 @@ func (*CartState) Descriptor() ([]byte, []int) { return file_cart_actor_proto_rawDescGZIP(), []int{13} } -func (x *CartState) GetCartId() string { +func (x *CartState) GetId() string { if x != nil { - return x.CartId + return x.Id } return "" } @@ -966,19 +965,26 @@ func (x *CartState) GetPaymentStatus() string { return "" } +func (x *CartState) GetProcessing() bool { + if x != nil { + return x.Processing + } + return false +} + type CartItemState struct { state protoimpl.MessageState `protogen:"open.v1"` Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - SourceItemId int64 `protobuf:"varint,2,opt,name=source_item_id,json=sourceItemId,proto3" json:"source_item_id,omitempty"` + ItemId int64 `protobuf:"varint,2,opt,name=itemId,proto3" json:"itemId,omitempty"` // was source_item_id Sku string `protobuf:"bytes,3,opt,name=sku,proto3" json:"sku,omitempty"` Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - UnitPrice int64 `protobuf:"varint,5,opt,name=unit_price,json=unitPrice,proto3" json:"unit_price,omitempty"` - Quantity int32 `protobuf:"varint,6,opt,name=quantity,proto3" json:"quantity,omitempty"` - TotalPrice int64 `protobuf:"varint,7,opt,name=total_price,json=totalPrice,proto3" json:"total_price,omitempty"` - TotalTax int64 `protobuf:"varint,8,opt,name=total_tax,json=totalTax,proto3" json:"total_tax,omitempty"` - OrgPrice int64 `protobuf:"varint,9,opt,name=org_price,json=orgPrice,proto3" json:"org_price,omitempty"` - TaxRate int32 `protobuf:"varint,10,opt,name=tax_rate,json=taxRate,proto3" json:"tax_rate,omitempty"` - TotalDiscount int64 `protobuf:"varint,11,opt,name=total_discount,json=totalDiscount,proto3" json:"total_discount,omitempty"` + Price int64 `protobuf:"varint,5,opt,name=price,proto3" json:"price,omitempty"` // was unit_price + Qty int32 `protobuf:"varint,6,opt,name=qty,proto3" json:"qty,omitempty"` // was quantity + TotalPrice int64 `protobuf:"varint,7,opt,name=totalPrice,proto3" json:"totalPrice,omitempty"` // was total_price + TotalTax int64 `protobuf:"varint,8,opt,name=totalTax,proto3" json:"totalTax,omitempty"` // was total_tax + OrgPrice int64 `protobuf:"varint,9,opt,name=orgPrice,proto3" json:"orgPrice,omitempty"` // was org_price + TaxRate int32 `protobuf:"varint,10,opt,name=taxRate,proto3" json:"taxRate,omitempty"` // was tax_rate + TotalDiscount int64 `protobuf:"varint,11,opt,name=totalDiscount,proto3" json:"totalDiscount,omitempty"` Brand string `protobuf:"bytes,12,opt,name=brand,proto3" json:"brand,omitempty"` Category string `protobuf:"bytes,13,opt,name=category,proto3" json:"category,omitempty"` Category2 string `protobuf:"bytes,14,opt,name=category2,proto3" json:"category2,omitempty"` @@ -986,12 +992,12 @@ type CartItemState struct { Category4 string `protobuf:"bytes,16,opt,name=category4,proto3" json:"category4,omitempty"` Category5 string `protobuf:"bytes,17,opt,name=category5,proto3" json:"category5,omitempty"` Image string `protobuf:"bytes,18,opt,name=image,proto3" json:"image,omitempty"` - ArticleType string `protobuf:"bytes,19,opt,name=article_type,json=articleType,proto3" json:"article_type,omitempty"` - SellerId string `protobuf:"bytes,20,opt,name=seller_id,json=sellerId,proto3" json:"seller_id,omitempty"` - SellerName string `protobuf:"bytes,21,opt,name=seller_name,json=sellerName,proto3" json:"seller_name,omitempty"` + Type string `protobuf:"bytes,19,opt,name=type,proto3" json:"type,omitempty"` // was article_type + SellerId string `protobuf:"bytes,20,opt,name=sellerId,proto3" json:"sellerId,omitempty"` // was seller_id + SellerName string `protobuf:"bytes,21,opt,name=sellerName,proto3" json:"sellerName,omitempty"` // was seller_name Disclaimer string `protobuf:"bytes,22,opt,name=disclaimer,proto3" json:"disclaimer,omitempty"` Outlet string `protobuf:"bytes,23,opt,name=outlet,proto3" json:"outlet,omitempty"` - StoreId string `protobuf:"bytes,24,opt,name=store_id,json=storeId,proto3" json:"store_id,omitempty"` + StoreId string `protobuf:"bytes,24,opt,name=storeId,proto3" json:"storeId,omitempty"` // was store_id Stock int32 `protobuf:"varint,25,opt,name=stock,proto3" json:"stock,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1034,9 +1040,9 @@ func (x *CartItemState) GetId() int64 { return 0 } -func (x *CartItemState) GetSourceItemId() int64 { +func (x *CartItemState) GetItemId() int64 { if x != nil { - return x.SourceItemId + return x.ItemId } return 0 } @@ -1055,16 +1061,16 @@ func (x *CartItemState) GetName() string { return "" } -func (x *CartItemState) GetUnitPrice() int64 { +func (x *CartItemState) GetPrice() int64 { if x != nil { - return x.UnitPrice + return x.Price } return 0 } -func (x *CartItemState) GetQuantity() int32 { +func (x *CartItemState) GetQty() int32 { if x != nil { - return x.Quantity + return x.Qty } return 0 } @@ -1153,9 +1159,9 @@ func (x *CartItemState) GetImage() string { return "" } -func (x *CartItemState) GetArticleType() string { +func (x *CartItemState) GetType() string { if x != nil { - return x.ArticleType + return x.Type } return "" } @@ -1207,8 +1213,8 @@ type DeliveryState struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` Price int64 `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"` - ItemIds []int64 `protobuf:"varint,4,rep,packed,name=item_ids,json=itemIds,proto3" json:"item_ids,omitempty"` - PickupPoint *PickupPoint `protobuf:"bytes,5,opt,name=pickup_point,json=pickupPoint,proto3" json:"pickup_point,omitempty"` // Defined in messages.proto + Items []int64 `protobuf:"varint,4,rep,packed,name=items,proto3" json:"items,omitempty"` // was item_ids + PickupPoint *PickupPoint `protobuf:"bytes,5,opt,name=pickupPoint,proto3" json:"pickupPoint,omitempty"` // was pickup_point unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1264,9 +1270,9 @@ func (x *DeliveryState) GetPrice() int64 { return 0 } -func (x *DeliveryState) GetItemIds() []int64 { +func (x *DeliveryState) GetItems() []int64 { if x != nil { - return x.ItemIds + return x.Items } return nil } @@ -1348,58 +1354,64 @@ const file_cart_actor_proto_rawDesc = "" + "\acart_id\x18\x01 \x01(\tR\x06cartId\x12)\n" + "\x10client_timestamp\x18\x02 \x01(\x03R\x0fclientTimestamp\x120\n" + "\apayload\x18\n" + - " \x01(\v2\x16.messages.OrderCreatedR\apayload\"\xf1\x02\n" + - "\tCartState\x12\x17\n" + - "\acart_id\x18\x01 \x01(\tR\x06cartId\x12-\n" + - "\x05items\x18\x02 \x03(\v2\x17.messages.CartItemStateR\x05items\x12\x1f\n" + - "\vtotal_price\x18\x03 \x01(\x03R\n" + - "totalPrice\x12\x1b\n" + - "\ttotal_tax\x18\x04 \x01(\x03R\btotalTax\x12%\n" + - "\x0etotal_discount\x18\x05 \x01(\x03R\rtotalDiscount\x127\n" + + " \x01(\v2\x16.messages.OrderCreatedR\apayload\"\x81\x03\n" + + "\tCartState\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12-\n" + + "\x05items\x18\x02 \x03(\v2\x17.messages.CartItemStateR\x05items\x12\x1e\n" + + "\n" + + "totalPrice\x18\x03 \x01(\x03R\n" + + "totalPrice\x12\x1a\n" + + "\btotalTax\x18\x04 \x01(\x03R\btotalTax\x12$\n" + + "\rtotalDiscount\x18\x05 \x01(\x03R\rtotalDiscount\x127\n" + "\n" + "deliveries\x18\x06 \x03(\v2\x17.messages.DeliveryStateR\n" + - "deliveries\x12.\n" + - "\x13payment_in_progress\x18\a \x01(\bR\x11paymentInProgress\x12'\n" + - "\x0forder_reference\x18\b \x01(\tR\x0eorderReference\x12%\n" + - "\x0epayment_status\x18\t \x01(\tR\rpaymentStatus\"\xcd\x05\n" + - "\rCartItemState\x12\x0e\n" + - "\x02id\x18\x01 \x01(\x03R\x02id\x12$\n" + - "\x0esource_item_id\x18\x02 \x01(\x03R\fsourceItemId\x12\x10\n" + - "\x03sku\x18\x03 \x01(\tR\x03sku\x12\x12\n" + - "\x04name\x18\x04 \x01(\tR\x04name\x12\x1d\n" + + "deliveries\x12,\n" + + "\x11paymentInProgress\x18\a \x01(\bR\x11paymentInProgress\x12&\n" + + "\x0eorderReference\x18\b \x01(\tR\x0eorderReference\x12$\n" + + "\rpaymentStatus\x18\t \x01(\tR\rpaymentStatus\x12\x1e\n" + "\n" + - "unit_price\x18\x05 \x01(\x03R\tunitPrice\x12\x1a\n" + - "\bquantity\x18\x06 \x01(\x05R\bquantity\x12\x1f\n" + - "\vtotal_price\x18\a \x01(\x03R\n" + - "totalPrice\x12\x1b\n" + - "\ttotal_tax\x18\b \x01(\x03R\btotalTax\x12\x1b\n" + - "\torg_price\x18\t \x01(\x03R\borgPrice\x12\x19\n" + - "\btax_rate\x18\n" + - " \x01(\x05R\ataxRate\x12%\n" + - "\x0etotal_discount\x18\v \x01(\x03R\rtotalDiscount\x12\x14\n" + + "processing\x18\n" + + " \x01(\bR\n" + + "processing\"\x95\x05\n" + + "\rCartItemState\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" + + "\x06itemId\x18\x02 \x01(\x03R\x06itemId\x12\x10\n" + + "\x03sku\x18\x03 \x01(\tR\x03sku\x12\x12\n" + + "\x04name\x18\x04 \x01(\tR\x04name\x12\x14\n" + + "\x05price\x18\x05 \x01(\x03R\x05price\x12\x10\n" + + "\x03qty\x18\x06 \x01(\x05R\x03qty\x12\x1e\n" + + "\n" + + "totalPrice\x18\a \x01(\x03R\n" + + "totalPrice\x12\x1a\n" + + "\btotalTax\x18\b \x01(\x03R\btotalTax\x12\x1a\n" + + "\borgPrice\x18\t \x01(\x03R\borgPrice\x12\x18\n" + + "\ataxRate\x18\n" + + " \x01(\x05R\ataxRate\x12$\n" + + "\rtotalDiscount\x18\v \x01(\x03R\rtotalDiscount\x12\x14\n" + "\x05brand\x18\f \x01(\tR\x05brand\x12\x1a\n" + "\bcategory\x18\r \x01(\tR\bcategory\x12\x1c\n" + "\tcategory2\x18\x0e \x01(\tR\tcategory2\x12\x1c\n" + "\tcategory3\x18\x0f \x01(\tR\tcategory3\x12\x1c\n" + "\tcategory4\x18\x10 \x01(\tR\tcategory4\x12\x1c\n" + "\tcategory5\x18\x11 \x01(\tR\tcategory5\x12\x14\n" + - "\x05image\x18\x12 \x01(\tR\x05image\x12!\n" + - "\farticle_type\x18\x13 \x01(\tR\varticleType\x12\x1b\n" + - "\tseller_id\x18\x14 \x01(\tR\bsellerId\x12\x1f\n" + - "\vseller_name\x18\x15 \x01(\tR\n" + + "\x05image\x18\x12 \x01(\tR\x05image\x12\x12\n" + + "\x04type\x18\x13 \x01(\tR\x04type\x12\x1a\n" + + "\bsellerId\x18\x14 \x01(\tR\bsellerId\x12\x1e\n" + + "\n" + + "sellerName\x18\x15 \x01(\tR\n" + "sellerName\x12\x1e\n" + "\n" + "disclaimer\x18\x16 \x01(\tR\n" + "disclaimer\x12\x16\n" + - "\x06outlet\x18\x17 \x01(\tR\x06outlet\x12\x19\n" + - "\bstore_id\x18\x18 \x01(\tR\astoreId\x12\x14\n" + - "\x05stock\x18\x19 \x01(\x05R\x05stock\"\xa6\x01\n" + + "\x06outlet\x18\x17 \x01(\tR\x06outlet\x12\x18\n" + + "\astoreId\x18\x18 \x01(\tR\astoreId\x12\x14\n" + + "\x05stock\x18\x19 \x01(\x05R\x05stock\"\xa0\x01\n" + "\rDeliveryState\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" + "\bprovider\x18\x02 \x01(\tR\bprovider\x12\x14\n" + - "\x05price\x18\x03 \x01(\x03R\x05price\x12\x19\n" + - "\bitem_ids\x18\x04 \x03(\x03R\aitemIds\x128\n" + - "\fpickup_point\x18\x05 \x01(\v2\x15.messages.PickupPointR\vpickupPoint2\xed\x05\n" + + "\x05price\x18\x03 \x01(\x03R\x05price\x12\x14\n" + + "\x05items\x18\x04 \x03(\x03R\x05items\x127\n" + + "\vpickupPoint\x18\x05 \x01(\v2\x15.messages.PickupPointR\vpickupPoint2\xed\x05\n" + "\tCartActor\x12F\n" + "\n" + "AddRequest\x12\x1b.messages.AddRequestRequest\x1a\x1b.messages.CartMutationReply\x12@\n" + @@ -1471,7 +1483,7 @@ var file_cart_actor_proto_depIdxs = []int32{ 25, // 11: messages.OrderCompletedRequest.payload:type_name -> messages.OrderCreated 14, // 12: messages.CartState.items:type_name -> messages.CartItemState 15, // 13: messages.CartState.deliveries:type_name -> messages.DeliveryState - 26, // 14: messages.DeliveryState.pickup_point:type_name -> messages.PickupPoint + 26, // 14: messages.DeliveryState.pickupPoint:type_name -> messages.PickupPoint 3, // 15: messages.CartActor.AddRequest:input_type -> messages.AddRequestRequest 4, // 16: messages.CartActor.AddItem:input_type -> messages.AddItemRequest 5, // 17: messages.CartActor.RemoveItem:input_type -> messages.RemoveItemRequest diff --git a/proto/cart_actor.proto b/proto/cart_actor.proto index 9da8b8d..cf7ce58 100644 --- a/proto/cart_actor.proto +++ b/proto/cart_actor.proto @@ -109,33 +109,32 @@ message OrderCompletedRequest { OrderCreated payload = 10; } -// ----------------------------------------------------------------------------- -// Cart state snapshot (unchanged from v1 except envelope removal context) -// ----------------------------------------------------------------------------- +// Excerpt: updated messages for camelCase JSON output message CartState { - string cart_id = 1; + string id = 1; // was cart_id repeated CartItemState items = 2; - int64 total_price = 3; - int64 total_tax = 4; - int64 total_discount = 5; + int64 totalPrice = 3; // was total_price + int64 totalTax = 4; // was total_tax + int64 totalDiscount = 5; // was total_discount repeated DeliveryState deliveries = 6; - bool payment_in_progress = 7; - string order_reference = 8; - string payment_status = 9; + bool paymentInProgress = 7; // was payment_in_progress + string orderReference = 8; // was order_reference + string paymentStatus = 9; // was payment_status + bool processing = 10; // NEW (mirrors legacy CartGrain.processing) } message CartItemState { int64 id = 1; - int64 source_item_id = 2; + int64 itemId = 2; // was source_item_id string sku = 3; string name = 4; - int64 unit_price = 5; - int32 quantity = 6; - int64 total_price = 7; - int64 total_tax = 8; - int64 org_price = 9; - int32 tax_rate = 10; - int64 total_discount = 11; + int64 price = 5; // was unit_price + int32 qty = 6; // was quantity + int64 totalPrice = 7; // was total_price + int64 totalTax = 8; // was total_tax + int64 orgPrice = 9; // was org_price + int32 taxRate = 10; // was tax_rate + int64 totalDiscount = 11; string brand = 12; string category = 13; string category2 = 14; @@ -143,12 +142,12 @@ message CartItemState { string category4 = 16; string category5 = 17; string image = 18; - string article_type = 19; - string seller_id = 20; - string seller_name = 21; + string type = 19; // was article_type + string sellerId = 20; // was seller_id + string sellerName = 21; // was seller_name string disclaimer = 22; string outlet = 23; - string store_id = 24; + string storeId = 24; // was store_id int32 stock = 25; } @@ -156,8 +155,8 @@ message DeliveryState { int64 id = 1; string provider = 2; int64 price = 3; - repeated int64 item_ids = 4; - PickupPoint pickup_point = 5; // Defined in messages.proto + repeated int64 items = 4; // was item_ids + PickupPoint pickupPoint = 5; // was pickup_point } // (CheckoutRequest / CheckoutReply removed - checkout handled at HTTP layer) diff --git a/remote_grain_grpc.go b/remote_grain_grpc.go index bcc530c..12f5513 100644 --- a/remote_grain_grpc.go +++ b/remote_grain_grpc.go @@ -184,7 +184,7 @@ func (g *RemoteGrainGRPC) Apply(content interface{}, isReplay bool) (*CartGrain, } // Reconstruct a lightweight CartGrain (only fields we expose internally) grain := &CartGrain{ - Id: ToCartId(state.CartId), + Id: ToCartId(state.Id), TotalPrice: state.TotalPrice, TotalTax: state.TotalTax, TotalDiscount: state.TotalDiscount, @@ -201,11 +201,11 @@ func (g *RemoteGrainGRPC) Apply(content interface{}, isReplay bool) (*CartGrain, storeId := toPtr(it.StoreId) grain.Items = append(grain.Items, &CartItem{ Id: int(it.Id), - ItemId: int(it.SourceItemId), + ItemId: int(it.ItemId), Sku: it.Sku, Name: it.Name, - Price: it.UnitPrice, - Quantity: int(it.Quantity), + Price: it.Price, + Quantity: int(it.Qty), TotalPrice: it.TotalPrice, TotalTax: it.TotalTax, OrgPrice: it.OrgPrice, @@ -217,7 +217,7 @@ func (g *RemoteGrainGRPC) Apply(content interface{}, isReplay bool) (*CartGrain, Category4: it.Category4, Category5: it.Category5, Image: it.Image, - ArticleType: it.ArticleType, + ArticleType: it.Type, SellerId: it.SellerId, SellerName: it.SellerName, Disclaimer: it.Disclaimer, @@ -231,8 +231,8 @@ func (g *RemoteGrainGRPC) Apply(content interface{}, isReplay bool) (*CartGrain, if d == nil { continue } - intIds := make([]int, 0, len(d.ItemIds)) - for _, id := range d.ItemIds { + intIds := make([]int, 0, len(d.Items)) + for _, id := range d.Items { intIds = append(intIds, int(id)) } grain.Deliveries = append(grain.Deliveries, &CartDelivery{ @@ -266,7 +266,7 @@ func (g *RemoteGrainGRPC) GetCurrentState() (*CartGrain, error) { return nil, fmt.Errorf("state reply missing state on success") } grain := &CartGrain{ - Id: ToCartId(state.CartId), + Id: ToCartId(state.Id), TotalPrice: state.TotalPrice, TotalTax: state.TotalTax, TotalDiscount: state.TotalDiscount, @@ -282,11 +282,11 @@ func (g *RemoteGrainGRPC) GetCurrentState() (*CartGrain, error) { storeId := toPtr(it.StoreId) grain.Items = append(grain.Items, &CartItem{ Id: int(it.Id), - ItemId: int(it.SourceItemId), + ItemId: int(it.ItemId), Sku: it.Sku, Name: it.Name, - Price: it.UnitPrice, - Quantity: int(it.Quantity), + Price: it.Price, + Quantity: int(it.Qty), TotalPrice: it.TotalPrice, TotalTax: it.TotalTax, OrgPrice: it.OrgPrice, @@ -298,7 +298,7 @@ func (g *RemoteGrainGRPC) GetCurrentState() (*CartGrain, error) { Category4: it.Category4, Category5: it.Category5, Image: it.Image, - ArticleType: it.ArticleType, + ArticleType: it.Type, SellerId: it.SellerId, SellerName: it.SellerName, Disclaimer: it.Disclaimer, @@ -311,8 +311,8 @@ func (g *RemoteGrainGRPC) GetCurrentState() (*CartGrain, error) { if d == nil { continue } - intIds := make([]int, 0, len(d.ItemIds)) - for _, id := range d.ItemIds { + intIds := make([]int, 0, len(d.Items)) + for _, id := range d.Items { intIds = append(intIds, int(id)) } grain.Deliveries = append(grain.Deliveries, &CartDelivery{