Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/remove remainingattendeecapacity from b #229

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Set RemainingAttendeeCapacity and MaximumAttendeeCapacity to null as the do not belong in the B and P responses.
// Set RemainingAttendeeCapacity and MaximumAttendeeCapacity to null as they 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;
}

}
}
4 changes: 4 additions & 0 deletions Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ protected override async ValueTask BookOrderItems(List<OrderItemContext<Facility
// Set OrderItemId and access properties for each orderItemContext
ctx.SetOrderItemId(flowContext, bookedOrderItemInfo.OrderItemId);
BookedOrderItemHelper.AddPropertiesToBookedOrderItem(ctx, bookedOrderItemInfo);
// 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:
Expand Down Expand Up @@ -621,6 +623,8 @@ protected override async ValueTask ProposeOrderItems(List<OrderItemContext<Facil
foreach (var (ctx, bookedOrderItemInfo) in ctxGroup.Zip(bookedOrderItemInfos, (ctx, bookedOrderItemInfo) => (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:
Expand Down
6 changes: 5 additions & 1 deletion Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<OrderItemContext<SessionOpportunity>> orderItemContexts, StoreBookingFlowContext flowContext, OrderStateContext stateContext, OrderTransaction databaseTransaction)
{
Expand Down Expand Up @@ -581,6 +581,8 @@ protected override async ValueTask BookOrderItems(List<OrderItemContext<SessionO
// Set OrderItemId and access properties for each orderItemContext
ctx.SetOrderItemId(flowContext, bookedOrderItemInfo.OrderItemId);
BookedOrderItemHelper.AddPropertiesToBookedOrderItem(ctx, bookedOrderItemInfo);
// 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:
Expand Down Expand Up @@ -643,6 +645,8 @@ protected override async ValueTask ProposeOrderItems(List<OrderItemContext<Sessi
foreach (var (ctx, bookedOrderItemInfo) in ctxGroup.Zip(bookedOrderItemInfos, (ctx, bookedOrderItemInfo) => (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:
Expand Down
Loading