diff --git a/packages/openactive-broker-microservice/.vscode/launch.json b/packages/openactive-broker-microservice/.vscode/launch.json index b7da299c07..2f5dd9e893 100644 --- a/packages/openactive-broker-microservice/.vscode/launch.json +++ b/packages/openactive-broker-microservice/.vscode/launch.json @@ -4,6 +4,12 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "command": "npm start", + "name": "Run npm start", + "request": "launch", + "type": "node-terminal" + }, { "type": "node", "request": "launch", diff --git a/packages/openactive-broker-microservice/app.js b/packages/openactive-broker-microservice/app.js index a12534d680..11e428753a 100644 --- a/packages/openactive-broker-microservice/app.js +++ b/packages/openactive-broker-microservice/app.js @@ -520,6 +520,7 @@ function detectOpportunityType(opportunity) { case 'CourseInstance': return 'CourseInstanceSubEvent'; case 'EventSeries': + case undefined: case null: return 'Event'; default: @@ -697,14 +698,15 @@ function storeOpportunityItem(item) { parentIngested: item.state === 'deleted' ? false : parentOpportunityMap.has(item.data.superEvent) || parentOpportunityMap.has(item.data.facilityUse), }; + var hasNoParent = (item.data['@type'] === 'Event' || item.data['@type'] === 'OnDemandEvent') && item.data.superEvent == undefined; + if (row.jsonLdParentId != null && row.jsonLdId != null) { if (!parentIdIndex.has(row.jsonLdParentId)) parentIdIndex.set(row.jsonLdParentId, new Set()); parentIdIndex.get(row.jsonLdParentId).add(row.jsonLdId); } rowStoreMap.set(row.jsonLdId, row); - - if (row.parentIngested) { + if (row.parentIngested || hasNoParent) { processRow(row); } } diff --git a/packages/openactive-integration-tests/.vscode/launch.json b/packages/openactive-integration-tests/.vscode/launch.json index 0847cc55fb..894c3dc69a 100644 --- a/packages/openactive-integration-tests/.vscode/launch.json +++ b/packages/openactive-integration-tests/.vscode/launch.json @@ -1,6 +1,24 @@ { "version": "0.2.0", "configurations": [ + { + "command": "npm start --runInBand -- test/features/", + "name": "Run all configured tests", + "request": "launch", + "type": "node-terminal" + }, + { + "command": "npm start --runInBand -- test/features/payment/simple-book-with-payment", + "name": "Test simple booking with payment", + "request": "launch", + "type": "node-terminal" + }, + { + "command": "npm start --runInBand -- test/features/core/multiple-sellers", + "name": "Test Multiple sellers", + "request": "launch", + "type": "node-terminal" + }, { "name": "Debug Jest Tests", "type": "node", diff --git a/packages/openactive-integration-tests/test/features/README.md b/packages/openactive-integration-tests/test/features/README.md index ba28f66674..0cbc922f17 100644 --- a/packages/openactive-integration-tests/test/features/README.md +++ b/packages/openactive-integration-tests/test/features/README.md @@ -25,8 +25,8 @@ The tests for these features provide partial coverage but do not include all kno | core | Amending the OrderQuote before B ([amending-order-quote](./core/amending-order-quote/README.md)) | [Required](https://www.openactive.io/open-booking-api/EditorsDraft/#amending-the-orderquote-before-b) | Allows the basket to be updated for a particular order | [TestOpportunityBookable](https://openactive.io/test-interface#TestOpportunityBookable) x32 | | core | Common error conditions ([common-error-conditions](./core/common-error-conditions/README.md)) | [Required](https://openactive.io/open-booking-api/EditorsDraft/#error-model) | Tests C1, C2 and B for common error conditions applicable to all implementations | [TestOpportunityBookable](https://openactive.io/test-interface#TestOpportunityBookable) x21, [TestOpportunityBookablePaid](https://openactive.io/test-interface#TestOpportunityBookablePaid) x3 | | core | Simple Booking of free opportunities ([simple-book-free-opportunities](./core/simple-book-free-opportunities/README.md)) | [Required](https://www.openactive.io/open-booking-api/EditorsDraft/#free-opportunities) | The most simple form of booking, for free opportunities. Does not check for leases. | [TestOpportunityBookableFree](https://openactive.io/test-interface#TestOpportunityBookableFree) x8 | -| cancellation | Customer Requested Cancellation ([customer-requested-cancellation](./cancellation/customer-requested-cancellation/README.md)) | [Optional](https://www.openactive.io/open-booking-api/EditorsDraft/#customer-requested-cancellation) | Cancellation triggered by the Customer through the Broker | [TestOpportunityBookableCancellable](https://openactive.io/test-interface#TestOpportunityBookableCancellable) x1 | -| core | Multiple Sellers ([multiple-sellers](./core/multiple-sellers/README.md)) | [Optional](https://openactive.io/open-booking-api/EditorsDraft/#booking-pre-conditions) | The booking system is multi-tenanted and provides services to multiple sellers. | [TestOpportunityBookable](https://openactive.io/test-interface#TestOpportunityBookable) x2 | +| cancellation | Customer Requested Cancellation ([customer-requested-cancellation](./cancellation/customer-requested-cancellation/README.md)) | [Optional](https://www.openactive.io/open-booking-api/EditorsDraft/#customer-requested-cancellation) | Cancellation triggered by the Customer through the Broker | [TestOpportunityBookableCancellable](https://openactive.io/test-interface#TestOpportunityBookableCancellable) x2 | +| core | Multiple Sellers ([multiple-sellers](./core/multiple-sellers/README.md)) | [Optional](https://openactive.io/open-booking-api/EditorsDraft/#booking-pre-conditions) | The booking system is multi-tenanted and provides services to multiple sellers. | [TestOpportunityBookableFree](https://openactive.io/test-interface#TestOpportunityBookableFree) x2 | | core | Test interface ([test-interface](./core/test-interface/README.md)) | [Optional](https://openactive.io/test-interface/) | Open Booking API Test Interface implementation | [TestOpportunityBookable](https://openactive.io/test-interface#TestOpportunityBookable) x1 | | payment | Simple Booking of paid opportunities ([simple-book-with-payment](./payment/simple-book-with-payment/README.md)) | [Optional](https://www.openactive.io/open-booking-api/EditorsDraft/#step-by-step-process-description) | The most simple form of booking with payment. Does not check for leases. | [TestOpportunityBookablePaid](https://openactive.io/test-interface#TestOpportunityBookablePaid) x10, [TestOpportunityBookable](https://openactive.io/test-interface#TestOpportunityBookable) x3 | @@ -37,7 +37,7 @@ The tests for these features are fully stubbed, and are not yet implemented. | Category | Feature | Specification | Description | Prerequisites per Opportunity Type | |----------|---------|---------------|-------------|-------------------| -| core | AgentBroker mode ([agent-broker](./core/agent-broker/README.md)) | [Required](https://www.openactive.io/open-booking-api/EditorsDraft/#agentbroker) | Support for AgentBroker mode | | +| core | AgentBroker mode ([agent-broker](./core/agent-broker/README.md)) | [Required](https://www.openactive.io/open-booking-api/EditorsDraft/#agentbroker) | Support for AgentBroker mode | [TestOpportunityBookable](https://openactive.io/test-interface#TestOpportunityBookable) x4 | | core | RPDE Opportunity Feed ([opportunity-feed](./core/opportunity-feed/README.md)) | [Required](https://www.openactive.io/open-booking-api/EditorsDraft/#definition-of-a-bookable-opportunity-and-offer-pair) | Real-time opportunity data | | | core | Order Deletion Endpoint ([order-deletion](./core/order-deletion/README.md)) | [Required](https://www.openactive.io/open-booking-api/EditorsDraft/#order-deletion) | Check that Order Deletion correctly soft-deletes an Order that has already been emitted in the Orders feed | | | access | accessCode - manual access codes ([access-code](./access/access-code/README.md)) | [Optional](https://www.openactive.io/open-booking-api/EditorsDraft/#text-based-access-control) | Support for accessCode provided for a successful booking | | diff --git a/packages/openactive-integration-tests/test/features/cancellation/customer-requested-cancellation/README.md b/packages/openactive-integration-tests/test/features/cancellation/customer-requested-cancellation/README.md index 315d4537ec..11a4cbe731 100644 --- a/packages/openactive-integration-tests/test/features/cancellation/customer-requested-cancellation/README.md +++ b/packages/openactive-integration-tests/test/features/cancellation/customer-requested-cancellation/README.md @@ -12,7 +12,7 @@ See also: [.NET Tutorial](https://tutorials.openactive.io/open-booking-sdk/quick ### Test prerequisites Opportunities that match the following criteria must exist in the booking system (for each configured `bookableOpportunityTypesInScope`) for the configured primary Seller in order to use `useRandomOpportunities: true`. Alternatively the following `testOpportunityCriteria` values must be supported by the [test interface](https://openactive.io/test-interface/) of the booking system for `useRandomOpportunities: false`. -[TestOpportunityBookableCancellable](https://openactive.io/test-interface#TestOpportunityBookableCancellable) x3 +[TestOpportunityBookableCancellable](https://openactive.io/test-interface#TestOpportunityBookableCancellable) x2 ### Running tests for only this feature @@ -38,8 +38,7 @@ Update `default.json` within `packages/openactive-integration-tests/config/` as | Identifier | Name | Description | Prerequisites per Opportunity Type | |------------|------|-------------|---------------| | [book-and-cancel](./implemented/book-and-cancel-test.js) | Successful booking and cancellation. | A successful end to end booking including cancellation, including checking the Orders Feed. | [TestOpportunityBookableCancellable](https://openactive.io/test-interface#TestOpportunityBookableCancellable) x1 | -| [cancellation-not-permitted-error](./implemented/cancellation-not-permitted-error-test.js) | Successful booking and cancellation. | A successful end to end booking including cancellation, including checking the Orders Feed. | [TestOpportunityBookableCancellable](https://openactive.io/test-interface#TestOpportunityBookableCancellable) x1 | -| [patch-contains-excessive-properties-error](./implemented/patch-contains-excessive-properties-error-test.js) | Successful booking and unsuccessful cancellation due to PatchContainsExcessiveProperties error | PatchContainsExcessivePropertiesError returned because patch request includes other properties than @type, @context, orderProposalStatus and orderCustomerNote | [TestOpportunityBookableCancellable](https://openactive.io/test-interface#TestOpportunityBookableCancellable) x1 | +| [patch-contains-excessive-properties-error](./implemented/patch-contains-excessive-properties-error-test.js) | Successful booking and unsuccessful cancellation due to PatchContainsExcessivePropertiesError | PatchContainsExcessivePropertiesError returned because patch request includes other properties than @type, @context, orderProposalStatus and orderCustomerNote | [TestOpportunityBookableCancellable](https://openactive.io/test-interface#TestOpportunityBookableCancellable) x1 | | [unknown-order](./implemented/unknown-order-test.js) | Expect a UnknownOrderError for an Order that does not exist | Runs Order Cancellation for a non-existent Order (with a fictional UUID), expecting an UnknownOrderError error to be returned | | diff --git a/packages/openactive-integration-tests/test/features/core/multiple-sellers/README.md b/packages/openactive-integration-tests/test/features/core/multiple-sellers/README.md index 5a82b53cb9..4197814ad6 100644 --- a/packages/openactive-integration-tests/test/features/core/multiple-sellers/README.md +++ b/packages/openactive-integration-tests/test/features/core/multiple-sellers/README.md @@ -11,7 +11,7 @@ Coverage Status: **partial** ### Test prerequisites Opportunities that match the following criteria must exist in the booking system (for each configured `bookableOpportunityTypesInScope`) for the configured primary Seller in order to use `useRandomOpportunities: true`. Alternatively the following `testOpportunityCriteria` values must be supported by the [test interface](https://openactive.io/test-interface/) of the booking system for `useRandomOpportunities: false`. -[TestOpportunityBookable](https://openactive.io/test-interface#TestOpportunityBookable) x2 +[TestOpportunityBookableFree](https://openactive.io/test-interface#TestOpportunityBookableFree) x2 ### Running tests for only this feature @@ -36,6 +36,6 @@ Update `default.json` within `packages/openactive-integration-tests/config/` as | Identifier | Name | Description | Prerequisites per Opportunity Type | |------------|------|-------------|---------------| -| [conflicting-seller](./implemented/conflicting-seller-test.js) | SellerMismatchError for inconsistent Sellers of OrderItems | Runs C1, C2 and B where Sellers of OrderItems do not match and check SellerMismatchError is returned in all cases. | [TestOpportunityBookable](https://openactive.io/test-interface#TestOpportunityBookable) x2 | +| [conflicting-seller](./implemented/conflicting-seller-test.js) | SellerMismatchError for inconsistent Sellers of OrderItems | Runs C1, C2 and B where Sellers of OrderItems do not match and check SellerMismatchError is returned in all cases. | [TestOpportunityBookableFree](https://openactive.io/test-interface#TestOpportunityBookableFree) x2 | diff --git a/packages/openactive-integration-tests/test/features/core/multiple-sellers/implemented/conflicting-seller-test.js b/packages/openactive-integration-tests/test/features/core/multiple-sellers/implemented/conflicting-seller-test.js index 2106350788..508c594017 100644 --- a/packages/openactive-integration-tests/test/features/core/multiple-sellers/implemented/conflicting-seller-test.js +++ b/packages/openactive-integration-tests/test/features/core/multiple-sellers/implemented/conflicting-seller-test.js @@ -20,12 +20,12 @@ FeatureHelper.describeFeature(module, { singleOpportunityCriteriaTemplate: opportunityType => [ { opportunityType, - opportunityCriteria: 'TestOpportunityBookable', + opportunityCriteria: 'TestOpportunityBookableFree', seller: 'primary', }, { opportunityType, - opportunityCriteria: 'TestOpportunityBookable', + opportunityCriteria: 'TestOpportunityBookableFree', seller: 'secondary', }, ],