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..f506d119 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 (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 6dc4685e..912579f7 100644 --- a/Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs +++ b/Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs @@ -524,7 +524,7 @@ protected override async ValueTask LeaseOrderItems( } } } - // TODO: This should reuse code of LeaseOrderItem to be DRY. Similar logic is also used in ProposeOrderItems as well as + // TODO: This should reuse code of LeaseOrderItem to be DRY. Similar logic is also used in ProposeOrderItems as well as // in LeaseOrderItems, BookOrderItems, and ProposeOrderItems in the SessionStore. The issue for this is: https://github.com/openactive/OpenActive.Server.NET/issues/226 protected override async ValueTask BookOrderItems(List> orderItemContexts, StoreBookingFlowContext flowContext, OrderStateContext stateContext, OrderTransaction databaseTransaction) { @@ -581,6 +581,8 @@ 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: