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

Proposed changes #254

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions packages/openactive-broker-microservice/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions packages/openactive-broker-microservice/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ function detectOpportunityType(opportunity) {
case 'CourseInstance':
return 'CourseInstanceSubEvent';
case 'EventSeries':
case undefined:
case null:
return 'Event';
default:
Expand Down Expand Up @@ -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);
}
}
Expand Down
18 changes: 18 additions & 0 deletions packages/openactive-integration-tests/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/openactive-integration-tests/test/features/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

Expand All @@ -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 | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 | |


Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 |


Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ FeatureHelper.describeFeature(module, {
singleOpportunityCriteriaTemplate: opportunityType => [
{
opportunityType,
opportunityCriteria: 'TestOpportunityBookable',
opportunityCriteria: 'TestOpportunityBookableFree',
seller: 'primary',
},
{
opportunityType,
opportunityCriteria: 'TestOpportunityBookable',
opportunityCriteria: 'TestOpportunityBookableFree',
seller: 'secondary',
},
],
Expand Down