ti2-bokun 1.0.0
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 +91 -0
- package/index.js +1026 -0
- package/package.json +58 -0
- package/resolvers/availability.js +366 -0
- package/resolvers/booking.js +356 -0
- package/resolvers/pickup-point.js +158 -0
- package/resolvers/product.js +155 -0
- package/resolvers/rate.js +33 -0
- package/utils/wildcardMatch.js +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# TI2 Bokun Plugin
|
|
2
|
+
|
|
3
|
+
This is a TourConnect TI2 plugin for integrating with the Bokun booking platform via the OCTO API.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
This plugin is designed to work with the TourConnect TI2 Docker environment. Make sure you have:
|
|
8
|
+
- Docker and Docker Compose installed
|
|
9
|
+
- The TI2 container running from `../bbtesting`
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
The plugin is automatically mounted into the TI2 container via the docker-compose-ti2.yml configuration.
|
|
14
|
+
|
|
15
|
+
To install dependencies within the TI2 container:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# From the bbtesting directory
|
|
19
|
+
cd ../bbtesting
|
|
20
|
+
docker-compose exec ti2 bash -c "cd /ti2-bokun && npm install"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or if you have Node.js installed locally:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Configuration
|
|
30
|
+
|
|
31
|
+
The plugin uses the following configuration:
|
|
32
|
+
|
|
33
|
+
### API Credentials
|
|
34
|
+
The `apiKey` (Bearer token for the OCTO API) is provided via:
|
|
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)
|
|
37
|
+
|
|
38
|
+
### User Configuration Parameters
|
|
39
|
+
The following parameters are configured by the user through TI2:
|
|
40
|
+
|
|
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
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
The plugin supports the following TI2 operations:
|
|
48
|
+
|
|
49
|
+
- **Token Validation**: Validates Bokun API credentials
|
|
50
|
+
- **Product Search**: Retrieves and translates Bokun products
|
|
51
|
+
- **Availability Search**: Checks product availability and pricing
|
|
52
|
+
- **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)
|
|
56
|
+
|
|
57
|
+
## API Authentication
|
|
58
|
+
|
|
59
|
+
The plugin uses Bearer token authentication for the Bokun OCTO API. Each request includes:
|
|
60
|
+
|
|
61
|
+
- `Authorization: Bearer {apiKey}`
|
|
62
|
+
- `Content-Type: application/json`
|
|
63
|
+
- `Octo-Capabilities: octo/pricing,octo/pickups,octo/cart,octo/offers,octo/questions`
|
|
64
|
+
|
|
65
|
+
## Testing
|
|
66
|
+
|
|
67
|
+
To run tests within the TI2 container:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# From the bbtesting directory
|
|
71
|
+
cd ../bbtesting
|
|
72
|
+
docker-compose exec ti2 bash -c "cd /ti2-bokun && npm test"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Or if you have Node.js installed locally:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm test
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Environment Setup
|
|
82
|
+
|
|
83
|
+
For development and testing, you can use Bokun's test environment:
|
|
84
|
+
|
|
85
|
+
- Test Extranet: https://extranet.bokuntest.com
|
|
86
|
+
- Test API: https://api.bokuntest.com/octo/v1
|
|
87
|
+
- Test App Store: https://appstore.bokuntest.com
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
GPL-3.0
|