ti2-bokun 1.0.2 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TI2 Bokun Plugin
2
2
 
3
- This is a TourConnect TI2 plugin for integrating with the Bokun booking platform via the OCTO API.
3
+ This is a TourConnect TI2 plugin for integrating with the Bokun booking platform using REST V1 APIs.
4
4
 
5
5
  ## Prerequisites
6
6
 
@@ -31,16 +31,17 @@ npm install
31
31
  The plugin uses the following configuration:
32
32
 
33
33
  ### API Credentials
34
- The `apiKey` (Bearer token for the OCTO API) is provided via:
34
+ The `accessKey` and `secretKey` are provided via:
35
35
  1. **TI2 instantiation** - Passed when creating the plugin instance (production use)
36
- 2. **Environment variables** - For testing: `ti2_bokun_apiKey` (already configured in Docker)
36
+ 2. **Environment variables** - For testing: `ti2_bokun_accesskey` and `ti2_bokun_secretkey` (already configured in Docker)
37
37
 
38
38
  ### User Configuration Parameters
39
39
  The following parameters are configured by the user through TI2:
40
+ - `endpoint`: The Bokun API endpoint (default: https://api.bokun.io, use https://api.bokuntest.com for testing)
41
+ - `tenant`: Your Bokun vendor **subdomain** (the hostname prefix before `.bokun.io` / `.bokuntest.com`). Used with `endpoint` to build `publicUrl` and `privateUrl` when the API does not return them (same idea as ti2-rezdy deriving URLs from the configured API host).
42
+ - `testMode`: Boolean flag to use test environment
40
43
 
41
- - `apiKey`: Bokun API key (Bearer token for OCTO API)
42
- - `endpoint`: The Bokun OCTO API endpoint (default: https://api.bokun.io/octo/v1; use https://api.bokuntest.com/octo/v1 for testing)
43
- - `tenant`: Bokun tenant subdomain for booking URL (e.g. `tourconnect-llc`). Enables `privateUrl` in booking information (format: `https://{tenant}.bokun.io/sales/{id}`)
44
+ **Booking URLs:** Both`publicUrl` / `privateUrl` (or related fields) are derived from `endpoint` + `tenant`: customer `publicUrl` as `https://{tenant}.{domain}/sales/{confirmationCode}`, and `privateUrl` as `https://{tenant}.{domain}/booking/{confirmationCode}` (same subdomain as your Bokun vendor site). Adjust paths if Bokun changes routing.
44
45
 
45
46
  ## Features
46
47
 
@@ -50,17 +51,33 @@ The plugin supports the following TI2 operations:
50
51
  - **Product Search**: Retrieves and translates Bokun products
51
52
  - **Availability Search**: Checks product availability and pricing
52
53
  - **Availability Calendar**: Returns availability in calendar format
53
- - **Create Booking**: Creates new bookings in Bokun (OCTO reserve + confirm flow)
54
- - **Search Booking**: Retrieves booking details by ID or travel date
55
- - **Cancel Booking**: Not yet implemented for OCTO (see code TODO)
54
+ - **Pickup Points**: Retrieves pickup locations for products
55
+ - **Create Booking**: Creates new bookings in Bokun
56
+ - **Cancel Booking**: Cancels existing bookings
57
+ - **Search Booking**: Retrieves booking details
58
+
59
+ ## API Compliance
60
+
61
+ This plugin uses the [Bókun REST v1 API](https://api-docs.bokun.dev/rest-v1) ([OpenAPI spec](https://api-docs.bokun.dev/rest-v1.yaml)). Endpoints used:
62
+
63
+ | TI2 operation | Method | Endpoint | Spec |
64
+ |-----------------|--------|----------|------|
65
+ | Token validation | `POST` | `/activity.json/search` | ActivityQuery body: `{ page, pageSize }` |
66
+ | Product search | `POST` | `/activity.json/search` | ActivityQuery body: `{ page, pageSize, currency? }` |
67
+ | Product by ID | `GET` | `/activity.json/{id}` | Query: `currency?`, `lang?` |
68
+ | Availability | `GET` | `/activity.json/{id}/availabilities` | Query: `start` (required), `end` (required), `currency?`, `includeSoldOut?` |
69
+ | Pickup places | `GET` | `/activity.json/{id}/pickup-places` | — |
70
+ | Create booking | `POST` | `/checkout.json/submit` then `/checkout.json/confirm-reserved/{confirmationCode}` | Checkout submit + confirm flow |
71
+ | Cancel booking | `POST` | `/booking.json/cancel-booking/{confirmationCode}` | Body: `{ note?, notify? }` |
72
+ | Get booking | `GET` | `/booking.json/booking/{confirmationCode}` | Query: `currency?`, `lang?` |
56
73
 
57
74
  ## API Authentication
58
75
 
59
- The plugin uses Bearer token authentication for the Bokun OCTO API. Each request includes:
76
+ The plugin implements Bokun's HMAC-SHA1 signature authentication as described in their API documentation. Each request includes:
60
77
 
61
- - `Authorization: Bearer {apiKey}`
62
- - `Content-Type: application/json`
63
- - `Octo-Capabilities: octo/pricing,octo/pickups,octo/cart,octo/offers,octo/questions`
78
+ - `X-Bokun-Date`: Request timestamp in UTC
79
+ - `X-Bokun-AccessKey`: Your access key
80
+ - `X-Bokun-Signature`: HMAC-SHA1 signature of the request
64
81
 
65
82
  ## Testing
66
83
 
@@ -72,18 +89,26 @@ cd ../bbtesting
72
89
  docker-compose exec ti2 bash -c "cd /ti2-bokun && npm test"
73
90
  ```
74
91
 
75
- Or if you have Node.js installed locally:
92
+ Or if you have Node.js installed locally in this plugin directory:
93
+
94
+ ```bash
95
+ npx jest "index.test.js" --config='{}'
96
+ ```
97
+
98
+ To run only the core operations covered in current regression tests:
76
99
 
77
100
  ```bash
78
- npm test
101
+ npx jest "index.test.js" --config='{}' --runInBand --testNamePattern="searchAvailability|createBooking|cancelBooking|searchBooking|validateToken|searchProducts|availabilityCalendar"
79
102
  ```
80
103
 
104
+ Note: some negative-path tests intentionally exercise error handling (for example invalid token, malformed availability key, or booking lookup failures). Those tests may print `console.error` lines while still passing.
105
+
81
106
  ## Environment Setup
82
107
 
83
108
  For development and testing, you can use Bokun's test environment:
84
109
 
85
- - Test Extranet: https://extranet.bokuntest.com
86
- - Test API: https://api.bokuntest.com/octo/v1
110
+ - Test Extranet: https://<your tenant>.bokuntest.com
111
+ - Test API: https://api.bokuntest.com
87
112
  - Test App Store: https://appstore.bokuntest.com
88
113
 
89
114
  ## License