Updating service_feed.py to include advance service hours example
diff --git a/order-redirect/python/service_feed.py b/order-redirect/python/service_feed.py
index c767772..98aaf1c 100644
--- a/order-redirect/python/service_feed.py
+++ b/order-redirect/python/service_feed.py
@@ -22,11 +22,11 @@
fee_data.fee.fixed_amount.units = 2
fee_data.fee.service_ids.append('merchant-1-service-delivery')
-#create service hours
-service_hours_data = feed.data.add()
-service_hours_data.service_hours.hours_id = 'merchant-1-advance-hours-delivery'
-service_hours_data.service_hours.service_ids.append('merchant-1-service-delivery')
-asap_hours = service_hours_data.service_hours.asap_hours.add()
+#create asap service hours
+asap_hours_data = feed.data.add()
+asap_hours_data.service_hours.hours_id = 'merchant-1-asap-hours-delivery'
+asap_hours_data.service_hours.service_ids.append('merchant-1-service-delivery')
+asap_hours = asap_hours_data.service_hours.asap_hours.add()
asap_hours.time_windows.MergeFrom(food_service_pb2.TimeOfDayWindow(
time_windows=food_service_pb2.TimeOfDayRange(
open_time=timeofday_pb2.TimeOfDay(
@@ -42,6 +42,49 @@
)
asap_hours.lead_time.min_lead_time_duration.seconds = 2400
-feedJSON = json.dumps(MessageToDict(feed, preserving_proto_field_name=True))
-print(feedJSON)
+#create advance service hours
+advance_hours_data = feed.data.add()
+advance_hours_data.service_hours.hours_id = 'merchant-1-advance-hours-delivery'
+advance_hours_data.service_hours.service_ids.append('merchant-1-service-delivery')
+advance_hours = advance_hours_data.service_hours.advance_hours.add()
+advance_hours.time_windows.MergeFrom(food_service_pb2.TimeOfDayWindow(
+ time_windows=food_service_pb2.TimeOfDayRange(
+ open_time=timeofday_pb2.TimeOfDay(
+ hours=11,
+ minutes=00
+ ),
+ close_time=timeofday_pb2.TimeOfDay(
+ hours=22,
+ minutes=00
+ )
+ )
+ )
+)
+advance_hours.advance_booking_interval.min_offset.seconds = 60*60
+advance_hours.advance_booking_interval.max_offset.seconds = 60*60*24*3
+orderable_time = advance_hours_data.service_hours.orderable_time.append(
+ food_service_pb2.TimeOfDayWindow(
+ time_windows=food_service_pb2.TimeOfDayRange(
+ open_time=timeofday_pb2.TimeOfDay(
+ hours=00,
+ minutes=00
+ ),
+ close_time=timeofday_pb2.TimeOfDay(
+ hours=23,
+ minutes=59
+ )
+ )
+ )
+)
+
+#create service area
+service_area_data = feed.data.add()
+service_area_data.service_area.area_id = 'merchant-1-area-delivery'
+service_area_data.service_area.service_ids.append('merchant-1-service-delivery')
+service_area_data.service_area.circle.center.latitude = 37.4215576
+service_area_data.service_area.circle.center.longitude = -122.0951056
+service_area_data.service_area.circle.radius = 5000
+
+feedJSON = json.dumps(MessageToDict(feed, preserving_proto_field_name=True))
+print(feedJSON)
\ No newline at end of file