@@ -30,23 +30,54 @@ public void AddPriceMessage(IList<PriceMessage> messages)
3030 currency = itm . StandardPrice . currency ,
3131 our_price = new List < PriceData > ( )
3232 {
33- new PriceData ( ) { schedule = new List < SchedulePriceData > ( ) { new SchedulePriceData ( ) { value_with_tax = itm . StandardPrice . Value } } }
33+ new PriceData ( )
34+ {
35+ schedule = new List < SchedulePriceData > ( )
36+ {
37+ new SchedulePriceData ( )
38+ {
39+ value_with_tax = itm . StandardPrice . Value
40+ }
41+ }
42+ }
3443 } ,
3544 } ;
3645
3746 if ( itm . MinimumSellerAllowedPrice != null )
3847 {
39- patcheValueData . minimum_seller_allowed_price = new List < PriceData > ( )
48+ patcheValueData . minimum_seller_allowed_price = new List < PriceData >
4049 {
41- new PriceData ( ) { schedule = new List < SchedulePriceData > ( ) { new SchedulePriceData ( ) { value_with_tax = itm . MinimumSellerAllowedPrice . Value } } }
50+ new PriceData
51+ {
52+ schedule = new List < SchedulePriceData >
53+ {
54+ new SchedulePriceData
55+ {
56+ value_with_tax = itm . MinimumSellerAllowedPrice . Value ,
57+ start_at = itm . MinimumSellerAllowedPrice . start_at ,
58+ end_at = itm . MinimumSellerAllowedPrice . end_at
59+ }
60+ }
61+ }
4262 } ;
4363 }
4464
4565 if ( itm . MaximumSellerAllowedPrice != null )
4666 {
47- patcheValueData . maximum_seller_allowed_price = new List < PriceData > ( )
67+ patcheValueData . maximum_seller_allowed_price = new List < PriceData >
4868 {
49- new PriceData ( ) { schedule = new List < SchedulePriceData > ( ) { new SchedulePriceData ( ) { value_with_tax = itm . MaximumSellerAllowedPrice . Value } } }
69+ new PriceData
70+ {
71+ schedule = new List < SchedulePriceData >
72+ {
73+ new SchedulePriceData
74+ {
75+ value_with_tax = itm . MaximumSellerAllowedPrice . Value ,
76+ start_at = itm . MaximumSellerAllowedPrice . start_at ,
77+ end_at = itm . MaximumSellerAllowedPrice . end_at
78+ }
79+ }
80+ }
5081 } ;
5182 }
5283
@@ -70,6 +101,51 @@ public void AddPriceMessage(IList<PriceMessage> messages)
70101 }
71102 }
72103
104+ public void AddInventoryMessage ( IList < InventoryMessage > messages )
105+ {
106+ int index = jsonMessagesData . messages . Count ;
107+ foreach ( var itm in messages )
108+ {
109+ var patcheValueData = new PatcheValueData ( )
110+ {
111+ fulfillment_channel_code = "DEFAULT"
112+ } ;
113+
114+ if ( itm . QuantitySpecified )
115+ {
116+ patcheValueData . quantity = itm . Quantity ;
117+ }
118+
119+ if ( itm . FulfillmentLatencySpecified )
120+ {
121+ patcheValueData . lead_time_to_ship_max_days = System . Convert . ToInt32 ( itm . FulfillmentLatency ) ;
122+ }
123+
124+ if ( itm . RestockDateSpecified )
125+ {
126+ patcheValueData . restock_date = itm . RestockDate ;
127+ }
128+
129+ var msg = new MessagesData ( )
130+ {
131+ messageId = ++ index ,
132+ sku = itm . SKU ,
133+ operationType = "PATCH" ,
134+ productType = "PRODUCT" ,
135+ patches = new List < PatcheData > {
136+ new PatcheData ( )
137+ {
138+ op = "replace" ,
139+ path = "/attributes/fulfillment_availability" ,
140+ value = new List < PatcheValueData > { patcheValueData }
141+ }
142+ }
143+ } ;
144+
145+ jsonMessagesData . messages . Add ( msg ) ;
146+ }
147+ }
148+
73149 public string GetJSON ( )
74150 {
75151 string jsonString = JsonConvert . SerializeObject ( jsonMessagesData , Formatting . Indented , new JsonSerializerSettings
0 commit comments