From 10342cd0ee95b15333f26c05d8c0e8a953cac90c Mon Sep 17 00:00:00 2001 From: Civ Sivakumaran Date: Thu, 28 Mar 2024 17:49:59 +0000 Subject: [PATCH 1/2] feat: remove remainingAttendeeCapacity and maximumAttendeeCapacity from B response --- .../Extensions/BookedOrderItemHelper.cs | 8 ++++++++ Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs | 2 ++ Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Examples/BookingSystem.AspNetCore/Extensions/BookedOrderItemHelper.cs b/Examples/BookingSystem.AspNetCore/Extensions/BookedOrderItemHelper.cs index 997599fd..1bb6965b 100644 --- a/Examples/BookingSystem.AspNetCore/Extensions/BookedOrderItemHelper.cs +++ b/Examples/BookingSystem.AspNetCore/Extensions/BookedOrderItemHelper.cs @@ -52,5 +52,13 @@ public static void AddPropertiesToBookedOrderItem(IOrderItemContext ctx, BookedO } } + public static void RemovePropertiesFromBookedOrderItem(IOrderItemContext ctx) + { + // Set RemainingAttendeeCapacity and MaximumAttendeeCapacity to null as the do not belong in the B and P responses. + // For more information see: https://github.com/openactive/open-booking-api/issues/156#issuecomment-926643733 + ctx.ResponseOrderItem.OrderedItem.Object.RemainingAttendeeCapacity = null; + ctx.ResponseOrderItem.OrderedItem.Object.MaximumAttendeeCapacity = null; + } + } } diff --git a/Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs b/Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs index cc8b6990..d6c6dfef 100644 --- a/Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs +++ b/Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs @@ -560,6 +560,8 @@ protected override async ValueTask BookOrderItems(List> orderItemContexts, StoreBookingFlowContext flowContext, OrderStateContext stateContext, OrderTransaction databaseTransaction) { @@ -581,6 +581,8 @@ protected override async ValueTask BookOrderItems(List Date: Thu, 28 Mar 2024 17:51:40 +0000 Subject: [PATCH 2/2] remove from P response too --- Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs | 2 ++ Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs b/Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs index d6c6dfef..f506d119 100644 --- a/Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs +++ b/Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs @@ -623,6 +623,8 @@ protected override async ValueTask ProposeOrderItems(List (ctx, bookedOrderItemInfo))) { ctx.SetOrderItemId(flowContext, bookedOrderItemInfo.OrderItemId); + // Remove attendee capacity information from the OrderedItem. For more information see: https://github.com/openactive/open-booking-api/issues/156#issuecomment-926643733 + BookedOrderItemHelper.RemovePropertiesFromBookedOrderItem(ctx); } break; case ReserveOrderItemsResult.SellerIdMismatch: diff --git a/Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs b/Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs index 2e4a8980..912579f7 100644 --- a/Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs +++ b/Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs @@ -582,7 +582,7 @@ protected override async ValueTask BookOrderItems(List (ctx, bookedOrderItemInfo))) { ctx.SetOrderItemId(flowContext, bookedOrderItemInfo.OrderItemId); + // Remove attendee capacity information from the OrderedItem. For more information see: https://github.com/openactive/open-booking-api/issues/156#issuecomment-926643733 + BookedOrderItemHelper.RemovePropertiesFromBookedOrderItem(ctx); } break; case ReserveOrderItemsResult.SellerIdMismatch: