Day 6: Orders feed
Last updated
Was this helpful?
Last updated
Was this helpful?
Create an Orders RPDE feed, respecting temporary authentication credentials.
The table used to store Orders should have been populated in . Day 6 exposes these Orders as an RPDE feed.
The StoreBookingEngine
handles the serialisation and parameter validation that would usually be required when implementing an RPDE feed. All that is required to implement the Orders feed is to implement a single method within a new class that inherits from the abstractOrdersRPDEFeedIncrementingUniqueChangeNumber
or OrdersRPDEFeedModifiedTimestampAndID
classes, which are very similar to the IOpportunityDataRPDEFeedGenerator
class from Day 2.
Within BookingEngineSettings
within EngineConfig.cs
the OrderFeedGenerator
setting configures which generator is called by the controller.
Two implementations of OrdersRPDEFeedGenerator
are available depending on your prefered :
OrdersRPDEFeedIncrementingUniqueChangeNumber
OrdersRPDEFeedModifiedTimestampAndID
Any of the above would require the same GetRPDEItems
method be implemented, as below, noting that the feed returned should be specific to the specified clientId
, and that updates to customerNotice
cause an item to be updated in the RPDE feed.
Within the mapping of your data to the OpenActive model, there are a few helper methods available from the base class to construct IDs specific for the feed:
Method
Example
RenderOpportunityWithOnlyId
OrderedItem = RenderOpportunityWithOnlyId(orderItemRow.OpportunityJsonLdType, new Uri(orderItemRow.OpportunityJsonLdId)),
RenderOrderId
Id = this.RenderOrderId(OrderType.Order, uuid),
RenderOrderItemId
Id = this.RenderOrderItemId(OrderType.Order, uuid, orderItemRow.Id),
RenderSellerId
(for Multiple Sellers)
Id = this.RenderSellerId(new SellerIdComponents
{
SellerIdLong = orderItemRow.sellerId
}),
RenderSingleSellerId
(for Single Seller)
Id = this.RenderSingleSellerId(),
To support seller requested cancellation and customer notification tests, implement the appropriate Actions with the following cases within the TriggerTestAction
method in the OrderStore.cs
:
Note that headers are used in the tests to provide a temporary clientId
in place of authentication credentials.
Run these tests in isolation as follows:
The appropriate query for the database for your chosen must be used, and the ordering of the items returned from your overridden method is automatically validated to ensure consistency with the specification.
The allows the test suite to test behaviours that are usually triggered by the Seller.
The , , and (if implemented) features within the openactive-integration-tests
test suite should pass.