fortrip 0.1.1 → 0.2.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/AGENT_GUIDE.md +128 -0
- package/README.md +16 -3
- package/dist/cli.js +25 -3
- package/guides/planning.md +54 -0
- package/package.json +3 -1
- package/skills/fortrip-hotels/SKILL.md +11 -120
package/AGENT_GUIDE.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Fortrip hotels
|
|
2
|
+
|
|
3
|
+
Fortrip sells hotel rooms at supplier net prices. The
|
|
4
|
+
`fortrip` CLI (npm package `fortrip`) calls the Fortrip API as the
|
|
5
|
+
signed-in user and prints JSON.
|
|
6
|
+
|
|
7
|
+
## When to use
|
|
8
|
+
|
|
9
|
+
- The user wants hotels in a city, near a point, or by name, for given dates.
|
|
10
|
+
- The user wants live rooms, meal plans, cancellation terms or prices for
|
|
11
|
+
specific hotels.
|
|
12
|
+
- The user has picked a rate and wants to book it (you return a payment link;
|
|
13
|
+
the user pays in their browser).
|
|
14
|
+
|
|
15
|
+
Not for flights, activities, or changing/cancelling an existing booking.
|
|
16
|
+
|
|
17
|
+
For flexible dates, a budget, split stays, several destinations or "find me
|
|
18
|
+
the best", also run `npx -y fortrip@latest skill planning` before searching.
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
Run every command as `npx -y fortrip@latest <command>`, the same version that
|
|
23
|
+
printed this guide. The examples below shorten that to `fortrip`.
|
|
24
|
+
|
|
25
|
+
When the user first asks about hotels, run `fortrip whoami` before asking
|
|
26
|
+
follow-up questions, so a login can happen while they answer.
|
|
27
|
+
|
|
28
|
+
If a command exits with code **3** and stderr has `loginUrl`, show it to the
|
|
29
|
+
user as a link together with `userCode`, e.g. "Sign in to Fortrip: <loginUrl>
|
|
30
|
+
(code BCDF-GHJK) and tell me when you're done." When they confirm, rerun the
|
|
31
|
+
same command; it finishes the login itself. Don't run `fortrip login` — it
|
|
32
|
+
waits for up to 10 minutes. If the rerun gives a new `loginUrl`, the old one
|
|
33
|
+
expired or was denied; show the new one.
|
|
34
|
+
|
|
35
|
+
If exit 3 has no `loginUrl`, the saved token was revoked: run `fortrip logout`,
|
|
36
|
+
then rerun the command to get a link.
|
|
37
|
+
|
|
38
|
+
In CI, the user can set `FORTRIP_TOKEN` instead. Never ask the user to paste a
|
|
39
|
+
token into the chat.
|
|
40
|
+
|
|
41
|
+
## Exit codes
|
|
42
|
+
|
|
43
|
+
| Code | Meaning | What to do |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| 0 | Success; JSON on stdout | Continue |
|
|
46
|
+
| 1 | Other error (supplier error, rate no longer bookable, network) | Read `error` on stderr; re-run `rates` if a rate went stale |
|
|
47
|
+
| 2 | Invalid arguments | Fix the flags; stderr `issues` lists the bad fields |
|
|
48
|
+
| 3 | Not logged in | Show `loginUrl` to the user, then rerun (above) |
|
|
49
|
+
| 4 | Rate limited | Wait `retryAfterSeconds`, then retry once |
|
|
50
|
+
|
|
51
|
+
## Recommended order
|
|
52
|
+
|
|
53
|
+
1. **Search** — find candidates and indicative prices:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
fortrip search --query "Bangkok" --check-in 2026-11-10 --check-out 2026-11-12 \
|
|
57
|
+
--star-min 4 --sort price-asc --page-size 10
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Use `--near lat,lng,radiusKm` for "near X", `--city-code` when known.
|
|
61
|
+
`--facility` names must match the catalogue exactly (e.g. `Swimming pool`,
|
|
62
|
+
`Parking`), otherwise nothing matches. Prices here (`price.nightlyFrom`,
|
|
63
|
+
`totalFrom`, CNY) are **indicative floors**, not quotes — say so.
|
|
64
|
+
|
|
65
|
+
2. **Hotel detail** (optional) — description, policies, facilities, photos:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
fortrip hotel 266000 [--with-rooms]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
3. **Rates** — live rooms and prices for up to 15 hotels:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
fortrip rates --hotel 266000 --hotel 266001 --check-in 2026-11-10 \
|
|
75
|
+
--check-out 2026-11-12 --rooms 1 --adults 2 [--child-age 6] \
|
|
76
|
+
[--nationality CN] [--board BB] [--free-cancellation]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
This call takes about 15 seconds. `totalPrice` is CNY at Stripe's exchange
|
|
80
|
+
rate (refreshed hourly). Present each option with meal plan (`boardCode`: RO room only,
|
|
81
|
+
BB breakfast, HB half board, FB full board, AI all inclusive),
|
|
82
|
+
`freeCancelUntil` / `refundable`, `isInstantConfirm`, and any `fees`
|
|
83
|
+
(taxes paid at the hotel, in their own currency).
|
|
84
|
+
|
|
85
|
+
4. **Book** — only after the user picks one rate and gives guest details:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
fortrip book --hotel 266000 --room-id 9191658 --rate-plan "<ratePlanCode>" \
|
|
89
|
+
--check-in 2026-11-10 --check-out 2026-11-12 --rooms 1 --adults 2 \
|
|
90
|
+
--guest "John Smith" --contact-name "John Smith" \
|
|
91
|
+
--contact-phone "+8613800000000" [--contact-email john@example.com]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`--hotel`, `--room-id`, `--rate-plan`, dates, `--rooms`, `--adults` and
|
|
95
|
+
`--child-age` must be exactly the values used in `rates`. Guest names must
|
|
96
|
+
be in Latin letters as on the passport ("First Last"; last word is the last
|
|
97
|
+
name; `"First Last:2"` puts the guest in room 2). Each room needs at least
|
|
98
|
+
one guest. `--special-requests` must be in English and isn't guaranteed.
|
|
99
|
+
|
|
100
|
+
## Before giving the payment link
|
|
101
|
+
|
|
102
|
+
`book` returns `paymentUrl`, `amount`, `currency`, `terms`, `statusUrl` and
|
|
103
|
+
`orderUrl`. Before you hand over `paymentUrl`:
|
|
104
|
+
|
|
105
|
+
1. **Show the `terms`** and get the user's confirmation: meal plan
|
|
106
|
+
(`boardCode`, `boardCount`), cancellation (`refundable`, `freeCancelUntil`,
|
|
107
|
+
the `cancellation` ladder), confirmation (`isInstantConfirm`,
|
|
108
|
+
`confirmByMins`) and `payAtHotelFees`.
|
|
109
|
+
2. **Explain the amount.** `rates` showed CNY, but the charge is `amount` in
|
|
110
|
+
`currency` (usually USD), and the Stripe page may display the user's local
|
|
111
|
+
currency at Stripe's rate. The CNY figure used a Stripe rate too, so it is
|
|
112
|
+
usually close, but the amount on the payment page is what will be charged;
|
|
113
|
+
the CNY figure was a reference.
|
|
114
|
+
3. The link is for **this user only**: whoever has it can pay. Don't post it
|
|
115
|
+
in shared channels, logs or tickets. It expires after about 3 hours 45
|
|
116
|
+
minutes; call `book` again with the same details for a fresh one.
|
|
117
|
+
|
|
118
|
+
After paying, the user lands on `statusUrl`, which shows confirmation progress
|
|
119
|
+
without signing in. `orderUrl` is the signed-in order page.
|
|
120
|
+
|
|
121
|
+
## Errors from `book`
|
|
122
|
+
|
|
123
|
+
- `409` with `agentOrderId`: this exact stay is already paid or completed —
|
|
124
|
+
show `orderUrl`, don't book again.
|
|
125
|
+
- `409` with `changes`: price or terms changed — re-run `rates` and confirm
|
|
126
|
+
again with the user.
|
|
127
|
+
- `422`: the booking was refused (guest names, too many attempts, bookings
|
|
128
|
+
paused, or a preview deployment). Read `error`.
|
package/README.md
CHANGED
|
@@ -53,9 +53,22 @@ Tokens don't expire; `logout` revokes them.
|
|
|
53
53
|
|
|
54
54
|
## Agent skill
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
```bash
|
|
57
|
+
npx skills add FortripEngineering/fortrip-cli
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
[`skills/fortrip-hotels/SKILL.md`](skills/fortrip-hotels/SKILL.md) only tells
|
|
61
|
+
the agent to run `npx -y fortrip@latest skill`, which prints
|
|
62
|
+
[`AGENT_GUIDE.md`](AGENT_GUIDE.md): when to use the CLI, the call order, login,
|
|
63
|
+
and what to show the user before handing over a payment link. The guide ships
|
|
64
|
+
with the package, so a CLI release updates every installed skill. Edit
|
|
65
|
+
`AGENT_GUIDE.md`, not `SKILL.md`.
|
|
66
|
+
|
|
67
|
+
`fortrip skill planning` prints [`guides/planning.md`](guides/planning.md):
|
|
68
|
+
what to ask, how to rank and how to present options for flexible dates,
|
|
69
|
+
budgets, split stays and several destinations. Both guides are printed with
|
|
70
|
+
`fortrip@latest` replaced by the running version, so an agent keeps using the
|
|
71
|
+
same CLI for the whole conversation.
|
|
59
72
|
|
|
60
73
|
## Development
|
|
61
74
|
|
package/dist/cli.js
CHANGED
|
@@ -22,7 +22,10 @@ function usageError(message) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// src/version.ts
|
|
25
|
-
|
|
25
|
+
import { readFileSync } from "fs";
|
|
26
|
+
var VERSION = JSON.parse(
|
|
27
|
+
readFileSync(new URL("../package.json", import.meta.url), "utf8")
|
|
28
|
+
).version;
|
|
26
29
|
|
|
27
30
|
// src/api.ts
|
|
28
31
|
var LOGIN_HINT = "Run `npx fortrip login` first.";
|
|
@@ -96,7 +99,7 @@ function unwrap(response) {
|
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
// src/args.ts
|
|
99
|
-
import { readFileSync } from "fs";
|
|
102
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
100
103
|
import { parseArgs } from "util";
|
|
101
104
|
var BODY_OPTION = { body: { type: "string" } };
|
|
102
105
|
function parse(argv, options) {
|
|
@@ -112,7 +115,7 @@ function baseBody(values) {
|
|
|
112
115
|
let text = raw;
|
|
113
116
|
if (raw.startsWith("@")) {
|
|
114
117
|
try {
|
|
115
|
-
text =
|
|
118
|
+
text = readFileSync2(raw.slice(1), "utf8");
|
|
116
119
|
} catch (error) {
|
|
117
120
|
throw usageError(`Cannot read --body file: ${error.message}`);
|
|
118
121
|
}
|
|
@@ -513,6 +516,19 @@ function deviceLabel() {
|
|
|
513
516
|
return hostname().replace(/[^\w .@-]/g, "").slice(0, 64);
|
|
514
517
|
}
|
|
515
518
|
|
|
519
|
+
// src/guide.ts
|
|
520
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
521
|
+
var GUIDES = {
|
|
522
|
+
main: "../AGENT_GUIDE.md",
|
|
523
|
+
planning: "../guides/planning.md"
|
|
524
|
+
};
|
|
525
|
+
async function readGuide(topic = "main") {
|
|
526
|
+
const path = GUIDES[topic];
|
|
527
|
+
if (!path) throw usageError("Usage: fortrip skill [planning]");
|
|
528
|
+
const guide = await readFile2(new URL(path, import.meta.url), "utf8");
|
|
529
|
+
return guide.replaceAll("fortrip@latest", `fortrip@${VERSION}`);
|
|
530
|
+
}
|
|
531
|
+
|
|
516
532
|
// src/cli.ts
|
|
517
533
|
var HELP = `fortrip ${VERSION} \u2014 search, price and book Fortrip hotels
|
|
518
534
|
|
|
@@ -526,6 +542,7 @@ Commands:
|
|
|
526
542
|
hotel <hotelId> Static hotel detail [--with-rooms]
|
|
527
543
|
rates Live rooms and rates (CNY) for up to 15 hotels
|
|
528
544
|
book Create an order and get a payment link
|
|
545
|
+
skill [planning] Print the guide for AI agents (Markdown)
|
|
529
546
|
|
|
530
547
|
search: --query <text> | --city-code <n> | --near <lat,lng,km>
|
|
531
548
|
--check-in YYYY-MM-DD --check-out YYYY-MM-DD
|
|
@@ -562,6 +579,11 @@ async function run(argv) {
|
|
|
562
579
|
`);
|
|
563
580
|
return void 0;
|
|
564
581
|
}
|
|
582
|
+
if (command === "skill") {
|
|
583
|
+
const { positionals } = parse(rest, {});
|
|
584
|
+
process.stdout.write(await readGuide(positionals.join(" ") || void 0));
|
|
585
|
+
return void 0;
|
|
586
|
+
}
|
|
565
587
|
const apiUrl = resolveApiUrl();
|
|
566
588
|
const log = (line) => process.stderr.write(`${line}
|
|
567
589
|
`);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Planning a hotel stay
|
|
2
|
+
|
|
3
|
+
Read this when the request is more than one hotel for fixed dates: flexible
|
|
4
|
+
dates, a budget, split stays, several destinations, or "find me the best".
|
|
5
|
+
Commands, login and the booking checklist are in `fortrip skill`; this covers
|
|
6
|
+
what to ask, how to compare and how to present. As there, `fortrip` is short
|
|
7
|
+
for `npx -y fortrip@latest`.
|
|
8
|
+
|
|
9
|
+
## What to collect
|
|
10
|
+
|
|
11
|
+
Keep track of: dates (or the flexible window), nights, destination(s), guests
|
|
12
|
+
and rooms, room constraints (beds, connecting rooms, accessibility), budget,
|
|
13
|
+
and what the user said matters most (cheapest, most flexible, closest to X).
|
|
14
|
+
|
|
15
|
+
Ask only for what changes which hotels qualify or how they rank. If children
|
|
16
|
+
come along, ask each child's age; `rates` and `book` need it. Don't ask for
|
|
17
|
+
trip type or style: infer it from the conversation or leave it general.
|
|
18
|
+
|
|
19
|
+
## Evidence
|
|
20
|
+
|
|
21
|
+
- A `search` price is a floor. Never call a search result available or
|
|
22
|
+
bookable.
|
|
23
|
+
- Use `hotel` only when a stated preference needs evidence (a pool, a
|
|
24
|
+
policy, room size).
|
|
25
|
+
- A hotel is available only once `rates` returned a live option for it.
|
|
26
|
+
- Anything the CLI didn't return, such as reviews, style, price trends or
|
|
27
|
+
exchange rates, is unknown. Say so instead of filling it in.
|
|
28
|
+
|
|
29
|
+
## Ranking
|
|
30
|
+
|
|
31
|
+
1. Drop options that break a hard constraint (dates, guests, budget cap,
|
|
32
|
+
required facility).
|
|
33
|
+
2. Keep only options with a live rate.
|
|
34
|
+
3. Order by the user's stated main goal. Goals they didn't state don't count.
|
|
35
|
+
4. Use other preferences only to break ties.
|
|
36
|
+
|
|
37
|
+
Use the cheapest comparable live room as the baseline unless the user fixed
|
|
38
|
+
the room type. Show at most three plans, each with its price difference from
|
|
39
|
+
the baseline and what it trades off (meal plan, cancellation, location,
|
|
40
|
+
instant confirmation). Keep hotel names as returned and dates in the user's
|
|
41
|
+
notation.
|
|
42
|
+
|
|
43
|
+
For a split stay or several destinations, price each leg with its own
|
|
44
|
+
`rates` call and add up the legs. Each leg is a separate `book` call and a
|
|
45
|
+
separate payment link.
|
|
46
|
+
|
|
47
|
+
## Stop and say so
|
|
48
|
+
|
|
49
|
+
- `rates` covers up to 15 hotels per call and takes about 15 seconds. If the
|
|
50
|
+
request needs more hotels or date combinations than a few calls can cover,
|
|
51
|
+
narrow it with the user, or present the result as a comparison of the
|
|
52
|
+
hotels you priced, not the best overall.
|
|
53
|
+
- Urgency is not consent: create a payment link only after the user picked a
|
|
54
|
+
rate and confirmed its terms.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fortrip",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Search, price and book Fortrip hotels from the terminal or an AI agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"skills",
|
|
12
|
+
"guides",
|
|
13
|
+
"AGENT_GUIDE.md",
|
|
12
14
|
"README.md"
|
|
13
15
|
],
|
|
14
16
|
"engines": {
|
|
@@ -1,129 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fortrip-hotels
|
|
3
|
-
description: Search hotels, compare live room rates and create a hotel booking with a payment link through Fortrip. Use when the user wants to find, price or book a hotel stay
|
|
3
|
+
description: Search hotels, compare live room rates and create a hotel booking with a payment link through Fortrip. Use when the user wants to find, compare, price or book a hotel stay, including flexible dates, budgets, split stays or several destinations, or asks for a hotel payment link.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Fortrip hotels
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
`fortrip` CLI (npm package `fortrip`) calls the Fortrip API as the
|
|
10
|
-
signed-in user and prints JSON.
|
|
8
|
+
Before anything else, run:
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
```bash
|
|
11
|
+
npx -y fortrip@latest skill
|
|
12
|
+
```
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
the user pays in their browser).
|
|
14
|
+
It prints the current instructions for the Fortrip CLI: commands, call order,
|
|
15
|
+
login, and what to show the user before giving a payment link. Follow them.
|
|
16
|
+
They ship with each CLI release, so this file stays short and doesn't go out
|
|
17
|
+
of date.
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## Setup
|
|
23
|
-
|
|
24
|
-
Run commands with `npx -y fortrip <command>` (or `fortrip <command>`
|
|
25
|
-
if installed globally).
|
|
26
|
-
|
|
27
|
-
When the user first asks about hotels, run `fortrip whoami` before asking
|
|
28
|
-
follow-up questions, so a login can happen while they answer.
|
|
29
|
-
|
|
30
|
-
If a command exits with code **3** and stderr has `loginUrl`, show it to the
|
|
31
|
-
user as a link together with `userCode`, e.g. "Sign in to Fortrip: <loginUrl>
|
|
32
|
-
(code BCDF-GHJK) and tell me when you're done." When they confirm, rerun the
|
|
33
|
-
same command; it finishes the login itself. Don't run `fortrip login` — it
|
|
34
|
-
waits for up to 10 minutes. If the rerun gives a new `loginUrl`, the old one
|
|
35
|
-
expired or was denied; show the new one.
|
|
36
|
-
|
|
37
|
-
If exit 3 has no `loginUrl`, the saved token was revoked: run `fortrip logout`,
|
|
38
|
-
then rerun the command to get a link.
|
|
39
|
-
|
|
40
|
-
In CI, the user can set `FORTRIP_TOKEN` instead. Never ask the user to paste a
|
|
41
|
-
token into the chat.
|
|
42
|
-
|
|
43
|
-
## Exit codes
|
|
44
|
-
|
|
45
|
-
| Code | Meaning | What to do |
|
|
46
|
-
|---|---|---|
|
|
47
|
-
| 0 | Success; JSON on stdout | Continue |
|
|
48
|
-
| 1 | Other error (supplier error, rate no longer bookable, network) | Read `error` on stderr; re-run `rates` if a rate went stale |
|
|
49
|
-
| 2 | Invalid arguments | Fix the flags; stderr `issues` lists the bad fields |
|
|
50
|
-
| 3 | Not logged in | Show `loginUrl` to the user, then rerun (above) |
|
|
51
|
-
| 4 | Rate limited | Wait `retryAfterSeconds`, then retry once |
|
|
52
|
-
|
|
53
|
-
## Recommended order
|
|
54
|
-
|
|
55
|
-
1. **Search** — find candidates and indicative prices:
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
fortrip search --query "Bangkok" --check-in 2026-11-10 --check-out 2026-11-12 \
|
|
59
|
-
--star-min 4 --sort price-asc --page-size 10
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Use `--near lat,lng,radiusKm` for "near X", `--city-code` when known.
|
|
63
|
-
`--facility` names must match the catalogue exactly (e.g. `Swimming pool`,
|
|
64
|
-
`Parking`), otherwise nothing matches. Prices here (`price.nightlyFrom`,
|
|
65
|
-
`totalFrom`, CNY) are **indicative floors**, not quotes — say so.
|
|
66
|
-
|
|
67
|
-
2. **Hotel detail** (optional) — description, policies, facilities, photos:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
fortrip hotel 266000 [--with-rooms]
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
3. **Rates** — live rooms and prices for up to 15 hotels:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
fortrip rates --hotel 266000 --hotel 266001 --check-in 2026-11-10 \
|
|
77
|
-
--check-out 2026-11-12 --rooms 1 --adults 2 [--child-age 6] \
|
|
78
|
-
[--nationality CN] [--board BB] [--free-cancellation]
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
This call takes about 15 seconds. `totalPrice` is CNY at a fixed exchange
|
|
82
|
-
rate. Present each option with meal plan (`boardCode`: RO room only,
|
|
83
|
-
BB breakfast, HB half board, FB full board, AI all inclusive),
|
|
84
|
-
`freeCancelUntil` / `refundable`, `isInstantConfirm`, and any `fees`
|
|
85
|
-
(taxes paid at the hotel, in their own currency).
|
|
86
|
-
|
|
87
|
-
4. **Book** — only after the user picks one rate and gives guest details:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
fortrip book --hotel 266000 --room-id 9191658 --rate-plan "<ratePlanCode>" \
|
|
91
|
-
--check-in 2026-11-10 --check-out 2026-11-12 --rooms 1 --adults 2 \
|
|
92
|
-
--guest "John Smith" --contact-name "John Smith" \
|
|
93
|
-
--contact-phone "+8613800000000" [--contact-email john@example.com]
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
`--hotel`, `--room-id`, `--rate-plan`, dates, `--rooms`, `--adults` and
|
|
97
|
-
`--child-age` must be exactly the values used in `rates`. Guest names must
|
|
98
|
-
be in Latin letters as on the passport ("First Last"; last word is the last
|
|
99
|
-
name; `"First Last:2"` puts the guest in room 2). Each room needs at least
|
|
100
|
-
one guest. `--special-requests` must be in English and isn't guaranteed.
|
|
101
|
-
|
|
102
|
-
## Before giving the payment link
|
|
103
|
-
|
|
104
|
-
`book` returns `paymentUrl`, `amount`, `currency`, `terms`, `statusUrl` and
|
|
105
|
-
`orderUrl`. Before you hand over `paymentUrl`:
|
|
106
|
-
|
|
107
|
-
1. **Show the `terms`** and get the user's confirmation: meal plan
|
|
108
|
-
(`boardCode`, `boardCount`), cancellation (`refundable`, `freeCancelUntil`,
|
|
109
|
-
the `cancellation` ladder), confirmation (`isInstantConfirm`,
|
|
110
|
-
`confirmByMins`) and `payAtHotelFees`.
|
|
111
|
-
2. **Explain the amount.** `rates` showed CNY, but the charge is `amount` in
|
|
112
|
-
`currency` (usually USD), and the Stripe page may display the user's local
|
|
113
|
-
currency at Stripe's rate. The amount on the payment page is what will be
|
|
114
|
-
charged; the CNY figure was a reference.
|
|
115
|
-
3. The link is for **this user only**: whoever has it can pay. Don't post it
|
|
116
|
-
in shared channels, logs or tickets. It expires after about 3 hours 45
|
|
117
|
-
minutes; call `book` again with the same details for a fresh one.
|
|
118
|
-
|
|
119
|
-
After paying, the user lands on `statusUrl`, which shows confirmation progress
|
|
120
|
-
without signing in. `orderUrl` is the signed-in order page.
|
|
121
|
-
|
|
122
|
-
## Errors from `book`
|
|
123
|
-
|
|
124
|
-
- `409` with `agentOrderId`: this exact stay is already paid or completed —
|
|
125
|
-
show `orderUrl`, don't book again.
|
|
126
|
-
- `409` with `changes`: price or terms changed — re-run `rates` and confirm
|
|
127
|
-
again with the user.
|
|
128
|
-
- `422`: the booking was refused (guest names, too many attempts, bookings
|
|
129
|
-
paused, or a preview deployment). Read `error`.
|
|
19
|
+
Needs Node.js 22 or newer. If the command fails, tell the user why instead of
|
|
20
|
+
guessing the CLI's flags.
|