@fortrip/agent-contract 4.1.0 → 4.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/README.md +4 -3
- package/dist/index.d.ts +109 -6
- package/dist/index.js +99 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,9 +33,10 @@ It exports:
|
|
|
33
33
|
- `COMMANDS`, `COMMAND_GROUPS` and `GLOBAL_FLAGS`, the CLI's commands, the
|
|
34
34
|
groups they are typed after and its flags, `commandInvocation(spec)`, a
|
|
35
35
|
command as it is typed (`fortrip hotels search`), and `TOOLS`, the MCP
|
|
36
|
-
tools, with `MCP_OUTPUT`, `ORDER_NEXT_STEP`, `CANCEL_NEXT_STEP
|
|
37
|
-
`PAY_NEXT_STEP`
|
|
38
|
-
word the last
|
|
36
|
+
tools, with `MCP_OUTPUT`, `ORDER_NEXT_STEP`, `CANCEL_NEXT_STEP`,
|
|
37
|
+
`PAY_NEXT_STEP` and `WALLET_NEXT_STEP` (`cancelNextStep(surface)`,
|
|
38
|
+
`payNextStep(surface)` and `walletNextStep(surface)` word the last three for
|
|
39
|
+
`"mcp"` or `"cli"`);
|
|
39
40
|
- `renderToolResult(tool, data, surface?)` and
|
|
40
41
|
`renderError(envelope, status?, surface?)`, the compact text of a result or
|
|
41
42
|
an error, naming tools (`"mcp"`, the default) or commands and flags
|
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,15 @@ declare const CANCEL_NEXT_STEP: string;
|
|
|
103
103
|
declare function payNextStep(surface: RenderSurface): string;
|
|
104
104
|
/** `payNextStep` over MCP. */
|
|
105
105
|
declare const PAY_NEXT_STEP: string;
|
|
106
|
+
/**
|
|
107
|
+
* How to pay with Alipay or WeChat Pay (spec §7), as `surface` names the
|
|
108
|
+
* call. It rides as the last paragraph of the text of every `book_hotel`,
|
|
109
|
+
* `get_order` and `list_orders` result that holds an order whose
|
|
110
|
+
* `payment.wallets` offers it without having opened it; never as `nextStep`.
|
|
111
|
+
*/
|
|
112
|
+
declare function walletNextStep(surface: RenderSurface): string;
|
|
113
|
+
/** `walletNextStep` over MCP. */
|
|
114
|
+
declare const WALLET_NEXT_STEP: string;
|
|
106
115
|
/**
|
|
107
116
|
* How to present hotels (the `presentation` guide, in one line). It rides as
|
|
108
117
|
* the last paragraph of every MCP `search_hotels`, `get_hotel` and
|
|
@@ -277,6 +286,18 @@ declare const MCP_OUTPUT: {
|
|
|
277
286
|
currency: z.ZodString;
|
|
278
287
|
expiresAt: z.ZodString;
|
|
279
288
|
}, z.core.$strip>>;
|
|
289
|
+
wallets: z.ZodNullable<z.ZodObject<{
|
|
290
|
+
open: z.ZodBoolean;
|
|
291
|
+
current: z.ZodNullable<z.ZodType<(string & {}) | "wechat_pay" | "alipay", unknown, z.core.$ZodTypeInternals<(string & {}) | "wechat_pay" | "alipay", unknown>>>;
|
|
292
|
+
wechatPay: z.ZodNullable<z.ZodObject<{
|
|
293
|
+
qrData: z.ZodNullable<z.ZodString>;
|
|
294
|
+
qrImageUrl: z.ZodNullable<z.ZodString>;
|
|
295
|
+
url: z.ZodString;
|
|
296
|
+
}, z.core.$strip>>;
|
|
297
|
+
alipay: z.ZodNullable<z.ZodObject<{
|
|
298
|
+
url: z.ZodString;
|
|
299
|
+
}, z.core.$strip>>;
|
|
300
|
+
}, z.core.$strip>>;
|
|
280
301
|
}, z.core.$strip>;
|
|
281
302
|
cancel: z.ZodObject<{
|
|
282
303
|
available: z.ZodBoolean;
|
|
@@ -449,6 +470,18 @@ declare const MCP_OUTPUT: {
|
|
|
449
470
|
currency: z.ZodString;
|
|
450
471
|
expiresAt: z.ZodString;
|
|
451
472
|
}, z.core.$strip>>;
|
|
473
|
+
wallets: z.ZodNullable<z.ZodObject<{
|
|
474
|
+
open: z.ZodBoolean;
|
|
475
|
+
current: z.ZodNullable<z.ZodType<(string & {}) | "wechat_pay" | "alipay", unknown, z.core.$ZodTypeInternals<(string & {}) | "wechat_pay" | "alipay", unknown>>>;
|
|
476
|
+
wechatPay: z.ZodNullable<z.ZodObject<{
|
|
477
|
+
qrData: z.ZodNullable<z.ZodString>;
|
|
478
|
+
qrImageUrl: z.ZodNullable<z.ZodString>;
|
|
479
|
+
url: z.ZodString;
|
|
480
|
+
}, z.core.$strip>>;
|
|
481
|
+
alipay: z.ZodNullable<z.ZodObject<{
|
|
482
|
+
url: z.ZodString;
|
|
483
|
+
}, z.core.$strip>>;
|
|
484
|
+
}, z.core.$strip>>;
|
|
452
485
|
}, z.core.$strip>;
|
|
453
486
|
cancel: z.ZodObject<{
|
|
454
487
|
available: z.ZodBoolean;
|
|
@@ -622,6 +655,18 @@ declare const MCP_OUTPUT: {
|
|
|
622
655
|
currency: z.ZodString;
|
|
623
656
|
expiresAt: z.ZodString;
|
|
624
657
|
}, z.core.$strip>>;
|
|
658
|
+
wallets: z.ZodNullable<z.ZodObject<{
|
|
659
|
+
open: z.ZodBoolean;
|
|
660
|
+
current: z.ZodNullable<z.ZodType<(string & {}) | "wechat_pay" | "alipay", unknown, z.core.$ZodTypeInternals<(string & {}) | "wechat_pay" | "alipay", unknown>>>;
|
|
661
|
+
wechatPay: z.ZodNullable<z.ZodObject<{
|
|
662
|
+
qrData: z.ZodNullable<z.ZodString>;
|
|
663
|
+
qrImageUrl: z.ZodNullable<z.ZodString>;
|
|
664
|
+
url: z.ZodString;
|
|
665
|
+
}, z.core.$strip>>;
|
|
666
|
+
alipay: z.ZodNullable<z.ZodObject<{
|
|
667
|
+
url: z.ZodString;
|
|
668
|
+
}, z.core.$strip>>;
|
|
669
|
+
}, z.core.$strip>>;
|
|
625
670
|
}, z.core.$strip>;
|
|
626
671
|
cancel: z.ZodObject<{
|
|
627
672
|
available: z.ZodBoolean;
|
|
@@ -796,6 +841,18 @@ declare const MCP_OUTPUT: {
|
|
|
796
841
|
currency: z.ZodString;
|
|
797
842
|
expiresAt: z.ZodString;
|
|
798
843
|
}, z.core.$strip>>;
|
|
844
|
+
wallets: z.ZodNullable<z.ZodObject<{
|
|
845
|
+
open: z.ZodBoolean;
|
|
846
|
+
current: z.ZodNullable<z.ZodType<(string & {}) | "wechat_pay" | "alipay", unknown, z.core.$ZodTypeInternals<(string & {}) | "wechat_pay" | "alipay", unknown>>>;
|
|
847
|
+
wechatPay: z.ZodNullable<z.ZodObject<{
|
|
848
|
+
qrData: z.ZodNullable<z.ZodString>;
|
|
849
|
+
qrImageUrl: z.ZodNullable<z.ZodString>;
|
|
850
|
+
url: z.ZodString;
|
|
851
|
+
}, z.core.$strip>>;
|
|
852
|
+
alipay: z.ZodNullable<z.ZodObject<{
|
|
853
|
+
url: z.ZodString;
|
|
854
|
+
}, z.core.$strip>>;
|
|
855
|
+
}, z.core.$strip>>;
|
|
799
856
|
}, z.core.$strip>;
|
|
800
857
|
cancel: z.ZodObject<{
|
|
801
858
|
available: z.ZodBoolean;
|
|
@@ -967,6 +1024,18 @@ declare const MCP_OUTPUT: {
|
|
|
967
1024
|
currency: z.ZodString;
|
|
968
1025
|
expiresAt: z.ZodString;
|
|
969
1026
|
}, z.core.$strip>>;
|
|
1027
|
+
wallets: z.ZodNullable<z.ZodObject<{
|
|
1028
|
+
open: z.ZodBoolean;
|
|
1029
|
+
current: z.ZodNullable<z.ZodType<(string & {}) | "wechat_pay" | "alipay", unknown, z.core.$ZodTypeInternals<(string & {}) | "wechat_pay" | "alipay", unknown>>>;
|
|
1030
|
+
wechatPay: z.ZodNullable<z.ZodObject<{
|
|
1031
|
+
qrData: z.ZodNullable<z.ZodString>;
|
|
1032
|
+
qrImageUrl: z.ZodNullable<z.ZodString>;
|
|
1033
|
+
url: z.ZodString;
|
|
1034
|
+
}, z.core.$strip>>;
|
|
1035
|
+
alipay: z.ZodNullable<z.ZodObject<{
|
|
1036
|
+
url: z.ZodString;
|
|
1037
|
+
}, z.core.$strip>>;
|
|
1038
|
+
}, z.core.$strip>>;
|
|
970
1039
|
}, z.core.$strip>;
|
|
971
1040
|
cancel: z.ZodObject<{
|
|
972
1041
|
available: z.ZodBoolean;
|
|
@@ -1407,10 +1476,11 @@ declare const cancelOrderInput: z.ZodObject<{
|
|
|
1407
1476
|
}, z.core.$strict>;
|
|
1408
1477
|
type CancelOrderInput = z.input<typeof cancelOrderInput>;
|
|
1409
1478
|
/** `POST /v1/orders/{orderId}/pay` and the MCP `pay_order` arguments: the
|
|
1410
|
-
* order,
|
|
1411
|
-
*
|
|
1412
|
-
*
|
|
1413
|
-
*
|
|
1479
|
+
* order, how to pay it, and the total the user approved. The way is a
|
|
1480
|
+
* Stripe shared payment token granted for the order, or `method`
|
|
1481
|
+
* (Alipay or WeChat Pay); with a token it is `sharedPaymentToken` or, as UCP's Complete
|
|
1482
|
+
* Checkout sends it, the credential of `payment`'s selected instrument.
|
|
1483
|
+
* Exactly one of `sharedPaymentToken`, `payment` and `method`. A total other than the order's answers
|
|
1414
1484
|
* `payment_total_changed` and charges nothing. */
|
|
1415
1485
|
declare const payOrderInput: z.ZodObject<{
|
|
1416
1486
|
orderId: z.ZodString;
|
|
@@ -1428,6 +1498,9 @@ declare const payOrderInput: z.ZodObject<{
|
|
|
1428
1498
|
display: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
1429
1499
|
}, z.core.$loose>>;
|
|
1430
1500
|
}, z.core.$strict>>;
|
|
1501
|
+
method: z.ZodOptional<z.ZodEnum<{
|
|
1502
|
+
alipay_wechat_pay: "alipay_wechat_pay";
|
|
1503
|
+
}>>;
|
|
1431
1504
|
total: z.ZodType<Money, unknown, z.core.$ZodTypeInternals<Money, unknown>>;
|
|
1432
1505
|
}, z.core.$strict>;
|
|
1433
1506
|
type PayOrderInput = z.input<typeof payOrderInput>;
|
|
@@ -1445,7 +1518,7 @@ declare const LIMITS: {
|
|
|
1445
1518
|
readonly nightsFortrip: 30;
|
|
1446
1519
|
readonly nightsSupplier: 15;
|
|
1447
1520
|
readonly offersHotels: 15;
|
|
1448
|
-
readonly offersPerHotelDefault:
|
|
1521
|
+
readonly offersPerHotelDefault: 10;
|
|
1449
1522
|
readonly offersPerHotelMax: 20;
|
|
1450
1523
|
readonly pageSizeDefault: 20;
|
|
1451
1524
|
readonly pageSizeMax: 50;
|
|
@@ -2602,6 +2675,20 @@ declare const order: z.ZodObject<{
|
|
|
2602
2675
|
currency: z.ZodString;
|
|
2603
2676
|
expiresAt: z.ZodString;
|
|
2604
2677
|
}, z.core.$strip>>;
|
|
2678
|
+
/** Paying with Alipay or WeChat Pay through `pay_order`'s `method`.
|
|
2679
|
+
* `null` when it is neither offered for the order nor open on it. */
|
|
2680
|
+
wallets: z.ZodNullable<z.ZodObject<{
|
|
2681
|
+
open: z.ZodBoolean;
|
|
2682
|
+
current: z.ZodNullable<z.ZodType<(string & {}) | "wechat_pay" | "alipay", unknown, z.core.$ZodTypeInternals<(string & {}) | "wechat_pay" | "alipay", unknown>>>;
|
|
2683
|
+
wechatPay: z.ZodNullable<z.ZodObject<{
|
|
2684
|
+
qrData: z.ZodNullable<z.ZodString>;
|
|
2685
|
+
qrImageUrl: z.ZodNullable<z.ZodString>;
|
|
2686
|
+
url: z.ZodString;
|
|
2687
|
+
}, z.core.$strip>>;
|
|
2688
|
+
alipay: z.ZodNullable<z.ZodObject<{
|
|
2689
|
+
url: z.ZodString;
|
|
2690
|
+
}, z.core.$strip>>;
|
|
2691
|
+
}, z.core.$strip>>;
|
|
2605
2692
|
}, z.core.$strip>;
|
|
2606
2693
|
/** Whether the user can cancel the order now and, when they can, its
|
|
2607
2694
|
* penalty under the accepted terms (read a minute ahead) and the refund,
|
|
@@ -2787,6 +2874,20 @@ declare const orderList: z.ZodObject<{
|
|
|
2787
2874
|
currency: z.ZodString;
|
|
2788
2875
|
expiresAt: z.ZodString;
|
|
2789
2876
|
}, z.core.$strip>>;
|
|
2877
|
+
/** Paying with Alipay or WeChat Pay through `pay_order`'s `method`.
|
|
2878
|
+
* `null` when it is neither offered for the order nor open on it. */
|
|
2879
|
+
wallets: z.ZodNullable<z.ZodObject<{
|
|
2880
|
+
open: z.ZodBoolean;
|
|
2881
|
+
current: z.ZodNullable<z.ZodType<(string & {}) | "wechat_pay" | "alipay", unknown, z.core.$ZodTypeInternals<(string & {}) | "wechat_pay" | "alipay", unknown>>>;
|
|
2882
|
+
wechatPay: z.ZodNullable<z.ZodObject<{
|
|
2883
|
+
qrData: z.ZodNullable<z.ZodString>;
|
|
2884
|
+
qrImageUrl: z.ZodNullable<z.ZodString>;
|
|
2885
|
+
url: z.ZodString;
|
|
2886
|
+
}, z.core.$strip>>;
|
|
2887
|
+
alipay: z.ZodNullable<z.ZodObject<{
|
|
2888
|
+
url: z.ZodString;
|
|
2889
|
+
}, z.core.$strip>>;
|
|
2890
|
+
}, z.core.$strip>>;
|
|
2790
2891
|
}, z.core.$strip>;
|
|
2791
2892
|
/** Whether the user can cancel the order now and, when they can, its
|
|
2792
2893
|
* penalty under the accepted terms (read a minute ahead) and the refund,
|
|
@@ -3428,6 +3529,8 @@ type RenderedTool = Exclude<ToolName, "get_planning_guide">;
|
|
|
3428
3529
|
* The consent rule (`ORDER_NEXT_STEP`) is the last paragraph whenever the
|
|
3429
3530
|
* result holds a non-null `payment.url`; the pay rule (`PAY_NEXT_STEP`)
|
|
3430
3531
|
* follows it when a result holds an order with non-empty `payment.handlers`;
|
|
3532
|
+
* the wallet rule (`WALLET_NEXT_STEP`) follows that when it holds an order
|
|
3533
|
+
* whose `payment.wallets` is offered and not open;
|
|
3431
3534
|
* the cancel rule (`CANCEL_NEXT_STEP`) follows it when a `get_order` or
|
|
3432
3535
|
* `list_orders` result holds an order with `cancel.available`. `surface`
|
|
3433
3536
|
* names the next calls: tools (`mcp`, the default) or commands (`cli`).
|
|
@@ -3450,4 +3553,4 @@ declare const UNKNOWN_IS_NOT_NO_EXEMPTIONS: Readonly<Record<string, string>>;
|
|
|
3450
3553
|
/** The contract's version, from package.json, the one place a release bumps it. */
|
|
3451
3554
|
declare const CONTRACT_VERSION: string;
|
|
3452
3555
|
|
|
3453
|
-
export { AMENITY_CODES, API, type AmenityCode, type AuthConfig, CANCEL_NEXT_STEP, CANCEL_REASONS, CARD_NUMBER_MESSAGE, CENTER_BASES, COMMANDS, COMMAND_GROUPS, CONTRACT_VERSION, CREDENTIAL_INVALID_REASONS, type CancelOrderInput, type CancelReason, type Center, type CommandGroupSpec, type CommandSpec, type CreateOrderInput, type CredentialInvalidReason, DISPLAY_CURRENCIES, type Destination, ERROR_CODES, ERROR_DETAILS, type ErrorBody, type ErrorCode, type ErrorEnvelope, FILTERABLE_AMENITIES, type FilterableAmenity, type FlagSpec, GLOBAL_FLAGS, type GetHotelInput, type GetOrderInput, type GuideSurface, type GuideTopic, type Hotel, type HotelOffersInput, type HotelOffersResult, type HotelSummary, type IndicativePrice, type KnownErrorBody, LIMITS, type ListOrdersInput, MCP_OUTPUT, MCP_PATH, type MeResult, type Money, ORDER_NEXT_STEP, ORDER_STATUSES, type Offer, type OfferChange, type Omitted, type OptionSpec, type Order, type OrderList, type OrderStatus, PAYMENT_STATUSES, PAY_NEXT_STEP, PLACE_KINDS, POLICY_TOPICS, PRESENTATION_HINT, PUBLIC_ORIGINS, type PayOrderInput, type PaymentHandler, type PaymentStatus, type Place, type PlaceRef, type PolicyTopic, type PositionalSpec, type RenderSurface, type RenderedTool, SEARCH_NOTE_CODES, SEARCH_SORTS, SUPPORT_EMAIL, type SearchHotelsInput, type SearchNoteCode, type SearchResult, type Stay, TOOLS, type ToolName, type ToolSpec, UNAVAILABLE_REASONS, UNKNOWN_IS_NOT_NO_EXEMPTIONS, addIsoDateDays, authConfig, cancelNextStep, cancelOrderInput, cancellation, center, commandInvocation, confirmation, containsCardNumber, countIsoDateDays, createOrderInput, createSearchHotelsInput, destination, errorEnvelope, flag, formatMoney, getHotelInput, getOrderInput, hotel, hotelId, hotelOffersInput, hotelOffersResult, hotelSummary, indicativePrice, instant, isIsoDate, knownLocaleText, latLng, listOrdersInput, localDate, localTime, localities, localizedText, meResult, meals, money, names, nonEmpty, offer, offerChange, offerId, omitted, oneOf, openEnum, openObject, openUnion, order, orderId, orderList, orderReference, parseOpen, payAtProperty, payNextStep, payOrderInput, paymentHandler, photo, place, placeId, placeRef, protocolObject, renderError, renderGuide, renderToolResult, roomFacts, searchHotelsInput, searchResult, sharedPaymentTokenOf, stay, stayEcho, strictInput, strictOutput, text, timeZone, usdMoney, wholeNumber };
|
|
3556
|
+
export { AMENITY_CODES, API, type AmenityCode, type AuthConfig, CANCEL_NEXT_STEP, CANCEL_REASONS, CARD_NUMBER_MESSAGE, CENTER_BASES, COMMANDS, COMMAND_GROUPS, CONTRACT_VERSION, CREDENTIAL_INVALID_REASONS, type CancelOrderInput, type CancelReason, type Center, type CommandGroupSpec, type CommandSpec, type CreateOrderInput, type CredentialInvalidReason, DISPLAY_CURRENCIES, type Destination, ERROR_CODES, ERROR_DETAILS, type ErrorBody, type ErrorCode, type ErrorEnvelope, FILTERABLE_AMENITIES, type FilterableAmenity, type FlagSpec, GLOBAL_FLAGS, type GetHotelInput, type GetOrderInput, type GuideSurface, type GuideTopic, type Hotel, type HotelOffersInput, type HotelOffersResult, type HotelSummary, type IndicativePrice, type KnownErrorBody, LIMITS, type ListOrdersInput, MCP_OUTPUT, MCP_PATH, type MeResult, type Money, ORDER_NEXT_STEP, ORDER_STATUSES, type Offer, type OfferChange, type Omitted, type OptionSpec, type Order, type OrderList, type OrderStatus, PAYMENT_STATUSES, PAY_NEXT_STEP, PLACE_KINDS, POLICY_TOPICS, PRESENTATION_HINT, PUBLIC_ORIGINS, type PayOrderInput, type PaymentHandler, type PaymentStatus, type Place, type PlaceRef, type PolicyTopic, type PositionalSpec, type RenderSurface, type RenderedTool, SEARCH_NOTE_CODES, SEARCH_SORTS, SUPPORT_EMAIL, type SearchHotelsInput, type SearchNoteCode, type SearchResult, type Stay, TOOLS, type ToolName, type ToolSpec, UNAVAILABLE_REASONS, UNKNOWN_IS_NOT_NO_EXEMPTIONS, WALLET_NEXT_STEP, addIsoDateDays, authConfig, cancelNextStep, cancelOrderInput, cancellation, center, commandInvocation, confirmation, containsCardNumber, countIsoDateDays, createOrderInput, createSearchHotelsInput, destination, errorEnvelope, flag, formatMoney, getHotelInput, getOrderInput, hotel, hotelId, hotelOffersInput, hotelOffersResult, hotelSummary, indicativePrice, instant, isIsoDate, knownLocaleText, latLng, listOrdersInput, localDate, localTime, localities, localizedText, meResult, meals, money, names, nonEmpty, offer, offerChange, offerId, omitted, oneOf, openEnum, openObject, openUnion, order, orderId, orderList, orderReference, parseOpen, payAtProperty, payNextStep, payOrderInput, paymentHandler, photo, place, placeId, placeRef, protocolObject, renderError, renderGuide, renderToolResult, roomFacts, searchHotelsInput, searchResult, sharedPaymentTokenOf, stay, stayEcho, strictInput, strictOutput, text, timeZone, usdMoney, walletNextStep, wholeNumber };
|
package/dist/index.js
CHANGED
|
@@ -174,7 +174,7 @@ var LIMITS = {
|
|
|
174
174
|
nightsFortrip: 30,
|
|
175
175
|
nightsSupplier: 15,
|
|
176
176
|
offersHotels: 15,
|
|
177
|
-
offersPerHotelDefault:
|
|
177
|
+
offersPerHotelDefault: 10,
|
|
178
178
|
offersPerHotelMax: 20,
|
|
179
179
|
pageSizeDefault: 20,
|
|
180
180
|
pageSizeMax: 50,
|
|
@@ -627,7 +627,7 @@ function selectedOf(instruments) {
|
|
|
627
627
|
var payOrderInput = strictInput({
|
|
628
628
|
orderId: orderId.describe("The orderId of the order to pay."),
|
|
629
629
|
sharedPaymentToken: z5.string({ error: sharedPaymentTokenError }).regex(sharedPaymentTokenRe, { error: sharedPaymentTokenError }).optional().describe(
|
|
630
|
-
"The shared payment token (spt_\u2026) the user approved for this order, requested with the order's payment.credentialLimits. Exactly one of sharedPaymentToken and
|
|
630
|
+
"The shared payment token (spt_\u2026) the user approved for this order, requested with the order's payment.credentialLimits. Exactly one of sharedPaymentToken, payment and method."
|
|
631
631
|
),
|
|
632
632
|
payment: strictInput({
|
|
633
633
|
instruments: z5.array(ucpInstrument, { error: instrumentsError }).min(1, { error: instrumentsError }).max(8, { error: instrumentsError }).describe("The instruments, exactly one of them selected.")
|
|
@@ -663,19 +663,28 @@ var payOrderInput = strictInput({
|
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
665
|
}).optional().describe(
|
|
666
|
-
"UCP's Complete Checkout payment, in place of sharedPaymentToken: the token as the stripe_payment_token credential of the one selected stripe_payments card instrument. Exactly one of sharedPaymentToken and
|
|
666
|
+
"UCP's Complete Checkout payment, in place of sharedPaymentToken: the token as the stripe_payment_token credential of the one selected stripe_payments card instrument. Exactly one of sharedPaymentToken, payment and method."
|
|
667
|
+
),
|
|
668
|
+
method: oneOf("method", ["alipay_wechat_pay"]).optional().describe(
|
|
669
|
+
"Pay with Alipay or WeChat Pay instead of a token: opens the payment and returns payment.wallets. Exactly one of sharedPaymentToken, payment and method."
|
|
667
670
|
),
|
|
668
671
|
total: usdMoney.describe(
|
|
669
672
|
"The total the user approved: the order's price.total, exactly as returned."
|
|
670
673
|
)
|
|
671
674
|
}).superRefine((input, ctx) => {
|
|
672
|
-
|
|
675
|
+
const given = [
|
|
676
|
+
["sharedPaymentToken", input.sharedPaymentToken],
|
|
677
|
+
["payment", input.payment],
|
|
678
|
+
["method", input.method]
|
|
679
|
+
].filter(([, value]) => value !== void 0);
|
|
680
|
+
const extra = given.length > 1 ? given.at(-1) : void 0;
|
|
681
|
+
if (extra) {
|
|
673
682
|
ctx.addIssue({
|
|
674
683
|
code: "custom",
|
|
675
|
-
path: [
|
|
676
|
-
message: "Send
|
|
684
|
+
path: [extra[0]],
|
|
685
|
+
message: "Send exactly one of sharedPaymentToken, payment and method"
|
|
677
686
|
});
|
|
678
|
-
} else if (
|
|
687
|
+
} else if (given.length === 0) {
|
|
679
688
|
ctx.addIssue({
|
|
680
689
|
code: "custom",
|
|
681
690
|
path: ["sharedPaymentToken"],
|
|
@@ -943,8 +952,14 @@ var payFlags = flagsOf(payOrderInput, [
|
|
|
943
952
|
field: "sharedPaymentToken",
|
|
944
953
|
type: "string",
|
|
945
954
|
placeholder: "<spt_\u2026>",
|
|
946
|
-
|
|
947
|
-
|
|
955
|
+
description: "Required unless --wallet. The spt_\u2026 token the user's Link wallet issued for this order."
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
flag: "wallet",
|
|
959
|
+
field: "method",
|
|
960
|
+
type: "boolean",
|
|
961
|
+
value: "alipay_wechat_pay",
|
|
962
|
+
description: "Pay with Alipay or WeChat Pay instead of a token: prints the WeChat Pay code and both links."
|
|
948
963
|
},
|
|
949
964
|
{
|
|
950
965
|
flag: "total",
|
|
@@ -1024,7 +1039,7 @@ var COMMANDS = [
|
|
|
1024
1039
|
{
|
|
1025
1040
|
group: "orders",
|
|
1026
1041
|
name: "pay",
|
|
1027
|
-
summary: "Pay an order
|
|
1042
|
+
summary: "Pay an order with a Link wallet token (US and Canada) or with Alipay or WeChat Pay, instead of its payment link",
|
|
1028
1043
|
tool: "pay_order",
|
|
1029
1044
|
flags: payFlags,
|
|
1030
1045
|
positionals: [positional(payOrderInput, "orderId")]
|
|
@@ -1227,12 +1242,12 @@ var FRAGMENTS = {
|
|
|
1227
1242
|
"errors": "{{#if claude-skill cli}}\n## Errors\n\n{{#if claude-skill}}A tool error{{/if}}{{#if cli}}An error on stderr{{/if}} carries `code`, `message` and `retryable`, and `retryAfterSeconds` when waiting helps; many carry `details`. Search errors are under Search. Ordering errors:\n\n| `code` | Do this |\n|---|---|\n| `offer_changed` (409) | The price or terms changed since the offer: `changes` lists every change (`worse` says which are worse for the user) and `offer` is the new offer. Show the user every change and ask again; if they still want it, order the new offer, and confirm the new order before giving its link |\n| `offer_expired` (409) | Get offers again and let the user choose again |\n| `offer_unavailable` (422) | The offer is sold out or was refused: get offers again and let the user choose again |\n| `order_in_progress` (409) | The same order is still being created: wait `retryAfterSeconds`, then {{#if claude-skill}}call again with the same details{{/if}}{{#if cli}}run the command again with identical flags{{/if}} |\n| `offer_already_ordered` (409) | This offer was already ordered with other details: show that order (`orderId`) instead. An offer is ordered once |\n| `order_exists` (409) | This stay already has an open order for one of these guests (`orderId`, `status`): show it instead of ordering again. A party with none of its guests can order the stay from a new offer (get offers again), and so can the user once the stay's order is confirmed, cancelled or refused by the hotel. It also answers when the stay's earlier order failed at the hotel with its outcome unknown, or the stay has had 20 orders; for those, the user emails {{support}} |\n| `order_attempts_exhausted` (409) | This order can't be tried again: the user emails {{support}} with its `reference` |\n| `order_removed` (410) | The order was never completed and no payment is held: get offers again and order the new offer (the order keeps its `orderId`) |\n| `stay_unsupported` (422) | `mixed_occupancy`: order once per party; `max_nights`: at most `max` nights per order |\n| `stay_in_past` (422) | Check-in has passed in the hotel's time zone: ask for new dates |\n| `ordering_paused` (503) | Ordering is paused on Fortrip's side: tell the user, and try again only after `retryAfterSeconds` (10 minutes or more) |\n\nAny code:\n\n- `invalid_request` (400): `details.issues` lists each bad field; fix them. For amenities, `details.filterable` lists those that can filter.\n- `cursor_invalid` (400): the page is gone; search again from the first page.\n- `not_found` (404): no such hotel, or no such order for this user.\n- `rate_limited` (429): wait `retryAfterSeconds`, then retry once.\n- `service_unavailable` (503) and `supplier_unavailable` (503 or 504): wait `retryAfterSeconds`, then retry once with the same details; if it fails again, tell the user.\n- Any other code: read `message`. If `retryable` is true, wait `retryAfterSeconds` and retry once; otherwise tell the user instead of guessing.\n{{/if}}\n",
|
|
1228
1243
|
"meals": '{{#if claude-skill cli}}\n## Presenting an offer\n\nGive the user, for each offer:\n\n- the room (`room.name`, beds, size) and the total, as above;\n- the meals: `meals.included` (breakfast, lunch, dinner) or `allInclusive`, with `guestsCoveredPerRoom`. Fewer than the guests per room means not everyone gets the meals (breakfast for 1 with 2 adults in the room): say who is covered. `unspecifiedMainMeals` counts main meals the hotel didn\'t name. With `known: false`, the meals are unknown: say so, and don\'t call it room only;\n- cancellation: `status` (`free`, `partial_penalty`, `non_refundable` or `unknown`), `freeCancellationEndsAt` (null with `free`: free until check-in) and the `penalties`. Times are in UTC: also give them in the hotel\'s `timeZone`;\n- confirmation: `mode` `instant` or `on_request` (within `withinMinutes`);\n- fees payable at the property (`payAtProperty.items`), in the property\'s currency. `disclosure: "incomplete"` means there can be fees not listed: say so.\n\nAn offer expires at `expiresAt`, about 30 minutes after it was made; after that, get offers again.\n\n"Not listed" is not "no": `listed: false` (amenities, policies, rooms), `null` and `unknown` mean the source didn\'t say. Tell the user it\'s unknown instead of turning it into "no".\n{{/if}}\n{{#if mcp}}\n- "Not listed" or "unknown" is not "no".\n{{/if}}\n',
|
|
1229
1244
|
"occupancy": "{{#if claude-skill cli}}\n## Rooms and guests\n\n- {{#if mcp claude-skill}}`stay.rooms` lists each room's party as `{ adults, childrenAges }`: two rooms of 2 adults, one with a child of 6, is `[{ adults: 2, childrenAges: [6] }, { adults: 2, childrenAges: [] }]`{{/if}}{{#if cli}}`--room <adults[:age,\u2026]>`, once per room, gives each room's party: two rooms of 2 adults, one with a child of 6, is `--room 2:6 --room 2`{{/if}}.\n- Ask each child's age; offers need it.\n- If the party doesn't split evenly across the rooms (3 adults in 2 rooms), ask the user how it splits.\n{{/if}}\n- Offers and orders take one party per call, every room the same: for different parties, order once per party.{{#if claude-skill cli}} `{{tool:hotels offers}}` answers `stay_unsupported` (`mixed_occupancy`) for mixed rooms; `{{tool:hotels search}}` accepts them but prices only from the dates, with the note `party_split_required`.{{/if}}\n{{#if claude-skill cli}}\n- Limits: 1\u2013{{limit:rooms}} rooms, 1\u2013{{limit:adultsPerRoom}} adults and 0\u2013{{limit:childrenPerRoom}} children (aged 0\u2013{{limit:childAgeMax}}) per room, 1\u2013{{limit:nightsSupplier}} nights, up to {{limit:offersHotels}} hotels per `{{tool:hotels offers}}` call. A longer stay answers `stay_unsupported` (`max_nights`): ask the user whether to split it into consecutive stays, each its own order.\n{{/if}}\n",
|
|
1230
|
-
"order": '{{#if claude-skill cli}}\n## Workflow\n\n1. **Search** with `{{tool:hotels search}}` for candidate hotels: a destination, `{{arg:text}}` or both, and the stay\'s dates and rooms for indicative prices.\n{{#if cli}}\n\n ```bash\n {{tool:hotels search}} --place-name Bangkok --country TH --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --stars-min 4 --sort price_asc --limit 10\n ```\n\n{{/if}}\n2. **Details** (optional) with `{{tool:hotels get}}`, when the user asks about a hotel or a stated preference needs evidence (a pool, a policy, room size). For a details-only question, call it directly when you know the hotel\'s `hotelId`; otherwise find the hotel with `{{tool:hotels search}}`.\n{{#if cli}}\n\n ```bash\n {{tool:hotels get}} <hotelId> [--rooms]\n ```\n\n{{/if}}\n3. **Offers** with `{{tool:hotels offers}}` for a few shortlisted hotels, with the dates and rooms the user will order. It takes about 15 seconds. A hotel is available only once this returns an offer for it.\n{{#if cli}}\n\n ```bash\n {{tool:hotels offers}} --hotel <hotelId> --hotel <hotelId> --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --room 2 [--require-free-cancellation]\n ```\n\n{{/if}}\n4. **Order** with `{{tool:hotels book}}`, once the user has picked one offer and given the guests and the contact (see Ordering).\n{{#if cli}}\n\n ```bash\n {{tool:hotels book}} --offer <offerId> --guest 1:John:Smith --guest 2:Mary:Smith \\\n --first-name John --last-name Smith --email john@example.com \\\n --phone "+8613800000000"\n ```\n\n{{/if}}\n5. **Confirm, then give the payment link**, as in "Before giving the payment link" below.\n6. **After payment**, check the order with `{{tool:orders get}}` (see After payment).\n\n## Search\n\n### Where\n\n- **A place by name:** {{#if mcp claude-skill}}`{ kind: "place_name", name, countryCode }`{{/if}}{{#if cli}}`--place-name <name> --country <CC>`{{/if}}, in any language (Kyoto or \u4EAC\u90FD). The country is required: ask the user when it isn\'t clear. Names match exactly, ignoring only case and spacing: accents, hyphens, apostrophes and periods count ("K\xF6ln" or "Cologne", not "Koln"; "St. Moritz", not "St Moritz").\n- If several places bear the name, the answer is `destination_ambiguous` with up to {{limit:candidatesShown}} candidates and their hotel counts: ask the user which one they mean, then search it by its `placeId`; never pick one yourself.\n- `destination_not_found` with `no_match` means no place of that name in that country: check the spelling and accents, or try another name for the place. Its `nameAsText` counts the hotels that a `{{arg:text}}` search for the name would find.\n- **A place from an earlier answer:** {{#if mcp claude-skill}}`{ kind: "place", placeId }`{{/if}}{{#if cli}}`--place <placeId>`{{/if}}.\n- **Near a point:** {{#if mcp claude-skill}}`{ kind: "point", location: { lat, lng } }`{{/if}}{{#if cli}}`--point <lat,lng>`{{/if}}, for "near X" when you know where X is.\n- **A whole country:** {{#if mcp claude-skill}}`{ kind: "country", countryCode }`{{/if}}{{#if cli}}`--country-only <CC>`{{/if}}, as for the Maldives.\n- Countries, regions (states, provinces), prefecture-level cities in China and main islands cover their whole area. Towns, neighbourhoods, districts, small islands and points cover a circle of {{limit:radiusMetersDefault}} meters; `{{arg:destination.radiusMeters}}` sets another, up to {{limit:radiusMetersMax}} meters, and narrows an area to a circle around its center.\n- **Localities:** an area search lists its `localities`, the towns its hotels belong to, each with a `placeId`, its hotel `count` and the places it `includes` (Patong is part of Phuket). To search one, pass it as {{#if mcp claude-skill}}`{ kind: "locality", placeId }`{{/if}}{{#if cli}}`--locality <placeId>`{{/if}}. A town that isn\'t a locality answers `destination_not_found` with `not_a_locality` and the `hub` it belongs to: search the hub, or the town itself with {{#if mcp claude-skill}}`kind: "place"`{{/if}}{{#if cli}}`--place`{{/if}} for a circle around it.\n- A price sort or price filter over more than {{limit:poolLimit}} hotels (in an area, or for text alone) answers `search_too_broad` with `matched` and the top `localities`: show them and ask the user which they prefer, unless the request already names one of them; search that one by its `placeId` as a locality, never by its name.\n\n### Text\n\n`{{arg:text}}` matches exact words in hotel names and addresses, in Chinese or English:\n\n- Every word must match as written: plurals, accents, spacing and abbreviations count ("hostel" and "hostels", "St Regis" and "Saint Regis" find different hotels). Hyphens and apostrophes don\'t (Ritz-Carlton finds Ritz Carlton).\n- In Chinese, matching follows word segmentation, so part of a name can match unrelated hotels (\u5E0C\u5C14 is not \u5E0C\u5C14\u987F).\n- Use only distinctive words: a hotel or brand name, a district or a landmark. Not "hotel", "near", "cheap" or "best".\n- Typos return nothing: "Shangahi" finds no hotel.\n- Place names belong in the destination: "Maldives" as text finds a hotel named Maldives in China.\n\n### Filters\n\n- Stars run from 1 to 5 in half steps{{#if mcp claude-skill}} (`filters.stars`){{/if}}. "4 stars" as {{#if mcp claude-skill}}`{ min: 4, max: 4 }`{{/if}}{{#if cli}}`--stars-min 4 --stars-max 4`{{/if}} leaves out 4.5: unless the user means exactly 4, use {{#if mcp claude-skill}}`{ min: 4 }`{{/if}}{{#if cli}}`--stars-min 4`{{/if}} or ask. Unrated hotels are left out whenever stars are filtered.\n- `{{arg:filters.amenities}}` takes only the amenities that can filter (such as pool, parking, wifi); others, such as gym or spa, show in `{{tool:hotels get}}` but can\'t filter. A hotel matches only when it lists the amenity, and about half the hotels list no amenities at all (`coverage.excludedNoFacilityData` counts those left out): "not listed" is not "absent".\n- `{{arg:filters.price.maxPerRoomNight}}` bounds the indicative price per room per night, in USD; hotels without one are left out and counted.\n\n### Results\n\n- `notes` explain the answer (a limited pool, a circle around an island, more hotels just outside it): pass on what matters to the user.\n- `coverage` has the counts: `matched` hotels, how many were priced and how many have a price.\n- A next page is {{#if mcp claude-skill}}`cursor` set to `nextCursor` and, optionally, `limit`{{/if}}{{#if cli}}`--cursor <nextCursor>` and, optionally, `--limit`{{/if}}; nothing else.\n{{/if}}\n{{#if mcp}}\n- A place name needs its `countryCode` (ask the user if unclear) and matches exactly (accents and periods count). On `destination_ambiguous`, ask the user which they mean, then search its `placeId`; never pick one yourself.\n- On `search_too_broad`, show its `localities` and ask the user which, unless they already named one; search it as `{ kind: "locality", placeId }`, never by name.\n- `text` matches whole words of hotel names and addresses: use a distinctive name, brand or landmark
|
|
1231
|
-
"payment-link": "{{#if claude-skill cli}}\n## Before giving the payment link\n\n`{{tool:hotels book}}` answers with an unpaid order: `status` `awaiting_payment`, its `reference` (the support number), `price.total`, the stay and its terms, and `payment.url`, a Fortrip page that recaps the order and continues to payment on Stripe. Nothing is charged until the user pays.\n\n1. Show the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation (status, deadline, penalties) and fees payable at the property, unknowns included.\n2. End that reply by asking the user to confirm, and wait for a clear yes. Urgency is not consent.\n3. Then give `payment.url` exactly as returned: don't shorten, rebuild or re-encode it.\n\n{{/if}}\n{{#if mcp}}\n- Pay one way only: give `payment.url` or call `{{tool:orders pay}}`. First show the order's total and currency, the stay and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give `payment.url` exactly as returned, to this user only: anyone holding it can pay.\n{{/if}}\n{{#if claude-skill cli}}\n- `payment.url` works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. With `requiresSignIn: true` (an order started on the Fortrip website), the user signs in to pay.\n- The link expires at `payment.expiresAt`; the order is then `expired`. To order the stay again, get offers again, and confirm the new order with the user before giving its link.\n- Another order of the stay (another party, or a corrected guest name) needs a new offer: get offers again. When it replaces an unpaid order, tell the user to pay only the new link; the earlier one expires unpaid.\n- An order `awaiting_payment` whose `payment.url` is null had its link unreadable this time: read it again with `{{tool:orders get}}`.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only through Stripe.{{#if claude-skill cli}} A card number in a guest name, the contact or the special requests is rejected{{#if cli}} with exit 2{{/if}}.{{/if}}\n{{#if claude-skill cli}}\n\n## Paying without the link\n\nAn order whose `payment.handlers` isn't empty (in {{#if claude-skill}}a result's text{{/if}}{{#if cli}}the text output{{/if}}, the line \"Pay without the link\") can also be paid through `{{tool:orders pay}}` with a Stripe shared payment token that the user's Link wallet grants for it. Use it only if you have a tool that can request such a token from the user's Link wallet: Link is for US and Canadian accounts, and caps a spend request at $500, so `payment.handlers` is empty for a larger order. Otherwise give `payment.url`, and never ask the user to create, type or paste a token.\n\n1. Show the user the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation and fees payable at the property. End that reply by asking the user to confirm, and wait for a clear yes. The token comes from the user's wallet, never from card details.\n2. Request the token from the user's Link wallet with the handler's `config.business_profile` and `payment.credentialLimits`: `maxAmount` (in cents), `currency` and `expiresAt`.\n3. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` with the token and the order's `price.total`{{#if cli}} (`--token`, `--total`){{/if}}{{#if claude-skill}}, the token as `sharedPaymentToken` or in UCP's `payment.instruments`{{/if}}. The order is then `confirming`, its payment `authorized`: check it as after payment.\n\nThe charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: either give `payment.url` or {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}`. Once `{{tool:orders pay}}` succeeds, `payment.url` stops working; a payment that fails leaves the link open. `payment_total_changed` means the total sent isn't the order's (`details.total`); the order's total hasn't changed: confirm it with the user, then {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}` again with it and the same token. `payment_declined`: the user picks another payment method in their wallet, or pays by link. `payment_action_required`: the card needs a verification this can't give: pay by link. `payment_credential_invalid`: request a new token with the order's `payment.credentialLimits`. `service_unavailable`: call `{{tool:orders pay}}` again with the same token, never a new one. A token pays one order only.\n\n## After payment\n\nCheck the order with `{{tool:orders get}}`:\n\n- `confirming` while the hotel confirms, then `confirmed` with the hotel's `confirmationNumber`.\n- `failed`: no stay was booked; `payment.status` says whether the payment was released or refunded.\n- `needs_attention`: Fortrip is looking into it; the user can email {{support}} with the `reference`.\n- `manageUrl` is the user's own page for the order.\n{{/if}}\n",
|
|
1245
|
+
"order": '{{#if claude-skill cli}}\n## Workflow\n\n1. **Search** with `{{tool:hotels search}}` for candidate hotels: a destination, `{{arg:text}}` or both, and the stay\'s dates and rooms for indicative prices.\n{{#if cli}}\n\n ```bash\n {{tool:hotels search}} --place-name Bangkok --country TH --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --stars-min 4 --sort price_asc --limit 10\n ```\n\n{{/if}}\n2. **Details** (optional) with `{{tool:hotels get}}`, when the user asks about a hotel or a stated preference needs evidence (a pool, a policy, room size). For a details-only question, call it directly when you know the hotel\'s `hotelId`; otherwise find the hotel with `{{tool:hotels search}}`.\n{{#if cli}}\n\n ```bash\n {{tool:hotels get}} <hotelId> [--rooms]\n ```\n\n{{/if}}\n3. **Offers** with `{{tool:hotels offers}}` for a few shortlisted hotels, with the dates and rooms the user will order. It takes about 15 seconds. A hotel is available only once this returns an offer for it.\n{{#if cli}}\n\n ```bash\n {{tool:hotels offers}} --hotel <hotelId> --hotel <hotelId> --check-in 2026-11-10 \\\n --check-out 2026-11-12 --room 2 --room 2 [--require-free-cancellation]\n ```\n\n{{/if}}\n4. **Order** with `{{tool:hotels book}}`, once the user has picked one offer and given the guests and the contact (see Ordering).\n{{#if cli}}\n\n ```bash\n {{tool:hotels book}} --offer <offerId> --guest 1:John:Smith --guest 2:Mary:Smith \\\n --first-name John --last-name Smith --email john@example.com \\\n --phone "+8613800000000"\n ```\n\n{{/if}}\n5. **Confirm, then give the payment link**, as in "Before giving the payment link" below.\n6. **After payment**, check the order with `{{tool:orders get}}` (see After payment).\n\n## Search\n\n### Where\n\n- **A place by name:** {{#if mcp claude-skill}}`{ kind: "place_name", name, countryCode }`{{/if}}{{#if cli}}`--place-name <name> --country <CC>`{{/if}}, in any language (Kyoto or \u4EAC\u90FD). The country is required: ask the user when it isn\'t clear. Names match exactly, ignoring only case and spacing: accents, hyphens, apostrophes and periods count ("K\xF6ln" or "Cologne", not "Koln"; "St. Moritz", not "St Moritz").\n- If several places bear the name, the answer is `destination_ambiguous` with up to {{limit:candidatesShown}} candidates and their hotel counts: ask the user which one they mean, then search it by its `placeId`; never pick one yourself.\n- `destination_not_found` with `no_match` means no place of that name in that country: check the spelling and accents, or try another name for the place. Its `nameAsText` counts the hotels that a `{{arg:text}}` search for the name would find.\n- **A place from an earlier answer:** {{#if mcp claude-skill}}`{ kind: "place", placeId }`{{/if}}{{#if cli}}`--place <placeId>`{{/if}}.\n- **Near a point:** {{#if mcp claude-skill}}`{ kind: "point", location: { lat, lng } }`{{/if}}{{#if cli}}`--point <lat,lng>`{{/if}}, for "near X" when you know where X is.\n- **A whole country:** {{#if mcp claude-skill}}`{ kind: "country", countryCode }`{{/if}}{{#if cli}}`--country-only <CC>`{{/if}}, as for the Maldives.\n- Countries, regions (states, provinces), prefecture-level cities in China and main islands cover their whole area. Towns, neighbourhoods, districts, small islands and points cover a circle of {{limit:radiusMetersDefault}} meters; `{{arg:destination.radiusMeters}}` sets another, up to {{limit:radiusMetersMax}} meters, and narrows an area to a circle around its center.\n- **Localities:** an area search lists its `localities`, the towns its hotels belong to, each with a `placeId`, its hotel `count` and the places it `includes` (Patong is part of Phuket). To search one, pass it as {{#if mcp claude-skill}}`{ kind: "locality", placeId }`{{/if}}{{#if cli}}`--locality <placeId>`{{/if}}. A town that isn\'t a locality answers `destination_not_found` with `not_a_locality` and the `hub` it belongs to: search the hub, or the town itself with {{#if mcp claude-skill}}`kind: "place"`{{/if}}{{#if cli}}`--place`{{/if}} for a circle around it.\n- A price sort or price filter over more than {{limit:poolLimit}} hotels (in an area, or for text alone) answers `search_too_broad` with `matched` and the top `localities`: show them and ask the user which they prefer, unless the request already names one of them; search that one by its `placeId` as a locality, never by its name.\n\n### Text\n\n`{{arg:text}}` matches exact words in hotel names and addresses, in Chinese or English:\n\n- Every word must match as written: plurals, accents, spacing and abbreviations count ("hostel" and "hostels", "St Regis" and "Saint Regis" find different hotels). Hyphens and apostrophes don\'t (Ritz-Carlton finds Ritz Carlton).\n- In Chinese, matching follows word segmentation, so part of a name can match unrelated hotels (\u5E0C\u5C14 is not \u5E0C\u5C14\u987F).\n- Use only distinctive words: a hotel or brand name, a district or a landmark. Not "hotel", "near", "cheap" or "best".\n- Typos return nothing: "Shangahi" finds no hotel.\n- Place names belong in the destination: "Maldives" as text finds a hotel named Maldives in China.\n\n### Filters\n\n- Stars run from 1 to 5 in half steps{{#if mcp claude-skill}} (`filters.stars`){{/if}}. "4 stars" as {{#if mcp claude-skill}}`{ min: 4, max: 4 }`{{/if}}{{#if cli}}`--stars-min 4 --stars-max 4`{{/if}} leaves out 4.5: unless the user means exactly 4, use {{#if mcp claude-skill}}`{ min: 4 }`{{/if}}{{#if cli}}`--stars-min 4`{{/if}} or ask. Unrated hotels are left out whenever stars are filtered.\n- `{{arg:filters.amenities}}` takes only the amenities that can filter (such as pool, parking, wifi); others, such as gym or spa, show in `{{tool:hotels get}}` but can\'t filter. A hotel matches only when it lists the amenity, and about half the hotels list no amenities at all (`coverage.excludedNoFacilityData` counts those left out): "not listed" is not "absent".\n- `{{arg:filters.price.maxPerRoomNight}}` bounds the indicative price per room per night, in USD; hotels without one are left out and counted.\n\n### Results\n\n- `notes` explain the answer (a limited pool, a circle around an island, more hotels just outside it): pass on what matters to the user.\n- `coverage` has the counts: `matched` hotels, how many were priced and how many have a price.\n- A next page is {{#if mcp claude-skill}}`cursor` set to `nextCursor` and, optionally, `limit`{{/if}}{{#if cli}}`--cursor <nextCursor>` and, optionally, `--limit`{{/if}}; nothing else.\n{{/if}}\n{{#if mcp}}\n- A place name needs its `countryCode` (ask the user if unclear) and matches exactly (accents and periods count). On `destination_ambiguous`, ask the user which they mean, then search its `placeId`; never pick one yourself.\n- On `search_too_broad`, show its `localities` and ask the user which, unless they already named one; search it as `{ kind: "locality", placeId }`, never by name.\n- `text` matches whole words of hotel names and addresses: use a distinctive name, brand or landmark.\n{{/if}}\n',
|
|
1246
|
+
"payment-link": "{{#if claude-skill cli}}\n## Before giving the payment link\n\n`{{tool:hotels book}}` answers with an unpaid order: `status` `awaiting_payment`, its `reference` (the support number), `price.total`, the stay and its terms, and `payment.url`, a Fortrip page that recaps the order and continues to payment on Stripe. Nothing is charged until the user pays.\n\n1. Show the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation (status, deadline, penalties) and fees payable at the property, unknowns included.\n2. End that reply by asking the user to confirm, and wait for a clear yes. Urgency is not consent.\n3. Then give `payment.url` exactly as returned: don't shorten, rebuild or re-encode it.\n\n{{/if}}\n{{#if mcp}}\n- Pay one way only: give `payment.url` or call `{{tool:orders pay}}`. First show the order's total and currency, the stay and every term, end that reply by asking the user to confirm, and wait for a clear yes. Then give `payment.url` exactly as returned, to this user only: anyone holding it can pay.\n{{/if}}\n{{#if claude-skill cli}}\n- `payment.url` works like a payment credential: anyone holding it can pay. Give it to this user only, never in shared channels, documents, logs or tickets. With `requiresSignIn: true` (an order started on the Fortrip website), the user signs in to pay.\n- The link expires at `payment.expiresAt`; the order is then `expired`. To order the stay again, get offers again, and confirm the new order with the user before giving its link.\n- Another order of the stay (another party, or a corrected guest name) needs a new offer: get offers again. When it replaces an unpaid order, tell the user to pay only the new link; the earlier one expires unpaid.\n- An order `awaiting_payment` whose `payment.url` is null had its link unreadable this time: read it again with `{{tool:orders get}}`.\n{{/if}}\n- Never ask for, accept or pass on payment card details; payment happens only through Stripe.{{#if claude-skill cli}} A card number in a guest name, the contact or the special requests is rejected{{#if cli}} with exit 2{{/if}}.{{/if}}\n{{#if claude-skill cli}}\n\n## Paying without the link\n\nAn order whose `payment.handlers` isn't empty (in {{#if claude-skill}}a result's text{{/if}}{{#if cli}}the text output{{/if}}, the line \"Pay without the link\") can also be paid through `{{tool:orders pay}}` with a Stripe shared payment token that the user's Link wallet grants for it. Use it only if you have a tool that can request such a token from the user's Link wallet: Link is for US and Canadian accounts, and caps a spend request at $500, so `payment.handlers` is empty for a larger order. Otherwise give `payment.url`, and never ask the user to create, type or paste a token.\n\n1. Show the user the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation and fees payable at the property. End that reply by asking the user to confirm, and wait for a clear yes. The token comes from the user's wallet, never from card details.\n2. Request the token from the user's Link wallet with the handler's `config.business_profile` and `payment.credentialLimits`: `maxAmount` (in cents), `currency` and `expiresAt`.\n3. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` with the token and the order's `price.total`{{#if cli}} (`--token`, `--total`){{/if}}{{#if claude-skill}}, the token as `sharedPaymentToken` or in UCP's `payment.instruments`{{/if}}. The order is then `confirming`, its payment `authorized`: check it as after payment.\n\nThe charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: either give `payment.url` or {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}`. Once `{{tool:orders pay}}` succeeds, `payment.url` stops working; a payment that fails leaves the link open. `payment_total_changed` means the total sent isn't the order's (`details.total`); the order's total hasn't changed: confirm it with the user, then {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}` again with it and the same token. `payment_declined`: the user picks another payment method in their wallet, or pays by link. `payment_action_required`: the card needs a verification this can't give: pay by link. `payment_credential_invalid`: request a new token with the order's `payment.credentialLimits`. `service_unavailable`: call `{{tool:orders pay}}` again with the same token, never a new one. A token pays one order only.\n\n## Paying with Alipay or WeChat Pay\n\nAn order whose result text has the line \"Pay with Alipay or WeChat Pay\" can be paid in the user's Alipay or WeChat wallet, with no token: it is for users who have a mainland-China wallet. {{#if claude-skill}}Call{{/if}}{{#if cli}}Run{{/if}} `{{tool:orders pay}}` {{#if claude-skill}}with `method` `alipay_wechat_pay`{{/if}}{{#if cli}}the way that line shows{{/if}} and the order's `price.total`, only after the user has confirmed.\n\n1. Show the user the order's total in USD, the stay (hotel, room, dates, rooms and guests per room) and every term: meals, cancellation and fees payable at the property. End that reply by asking the user to confirm, and wait for a clear yes. Pay one way only: `payment.url` or this.\n2. Then show `payment.wallets`: the WeChat Pay code as an image if you can, and both links (WeChat Pay and Alipay). The user pays once, by either. Alipay and WeChat Pay charge at once; if the hotel can't confirm, the payment is refunded in full. The total is in US dollars, and the wallets show it in yuan at their rate.\n3. Check the order with `{{tool:orders get}}` until it isn't `awaiting_payment`.\n\nA WeChat Pay code expires 120 minutes after it is made, and goes dead earlier if the user opens the Alipay link instead. Then `payment.wallets.wechatPay.qrData` is null: tell the user to open the WeChat link again, or {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders pay}}` again for a new code.\n\nWeChat can't scan a code shown on the same phone's screen. Offer both ways, since you can't tell which device the user is on: save the image and scan it from the album (WeChat, then Scan, then Album), or open the WeChat link on another screen; on a phone, the Alipay link opens the Alipay app.\n\n## After payment\n\nCheck the order with `{{tool:orders get}}`:\n\n- `confirming` while the hotel confirms, then `confirmed` with the hotel's `confirmationNumber`.\n- `failed`: no stay was booked; `payment.status` says whether the payment was released or refunded.\n- `needs_attention`: Fortrip is looking into it; the user can email {{support}} with the `reference`.\n- `manageUrl` is the user's own page for the order.\n{{/if}}\n",
|
|
1232
1247
|
"planning": "# Planning a hotel stay\n\nRead this when the request is more than one hotel for fixed dates: flexible dates, a budget, split stays, several destinations, or \"find me the best\". The rules in {{#if mcp}}the server instructions{{/if}}{{#if claude-skill}}SKILL.md{{/if}}{{#if cli}}`{{tool:guide}}`{{/if}} still apply (call order, destinations, one party per offer and order, confirming the order `{{tool:hotels book}}` returns before giving the payment link); this covers what to ask, how to compare and how to present.{{#if cli}} As there, `fortrip` is short for `npx -y fortrip@latest`.{{/if}}\n\n## What to collect\n\nKeep track of: dates (or the flexible window), nights, destination(s) with their country, rooms and the guests in each room, room constraints (beds, connecting rooms, accessibility), budget, and what the user said matters most (cheapest, most flexible, closest to X).\n\nOffers and orders take one party per call, every room the same, so if the party doesn't split evenly across the rooms, ask how it splits. Rooms for different parties are priced and ordered separately, each order with its own payment link.\n\nAsk only for what changes which hotels qualify or how they rank. \"4 stars\" as {{#if mcp claude-skill}}`{ min: 4, max: 4 }`{{/if}}{{#if cli}}`--stars-min 4 --stars-max 4`{{/if}} leaves out 4.5: unless the user means exactly 4, use {{#if mcp claude-skill}}`{ min: 4 }`{{/if}}{{#if cli}}`--stars-min 4`{{/if}} or ask. If children come along, ask each child's age; `{{tool:hotels offers}}` needs it. Don't ask for trip type or style: infer it from the conversation or leave it general. When a place name is ambiguous, ask which place the user means.\n\n## Evidence\n\n- A `{{tool:hotels search}}` price is an indicative estimate per room per night, not a quote. Never call a search result available or bookable, and once you have offers, compare offers only. A hotel without a search price can still have offers.\n- Use `{{tool:hotels get}}` only when a stated preference needs evidence (a pool, a policy, room size). An amenity or policy it doesn't list is unknown, not absent.\n- A hotel is available only once `{{tool:hotels offers}}` returned an offer for it.\n- Anything {{#if mcp claude-skill}}the tools{{/if}}{{#if cli}}the CLI{{/if}} didn't return, such as reviews, style, price trends or exchange rates other than `approx`, is unknown. Say so instead of filling it in.\n\n## Ranking\n\n1. Drop options that break a hard constraint (dates, guests, budget cap, required facility). Compare a budget in the unit the user gave it: per night, per room or for the whole stay. An offer's `price.total` covers the whole stay and every room, in USD.\n2. Keep only options with a live offer.\n3. Order by the user's stated main goal. Goals they didn't state don't count.\n4. Use other preferences only to break ties.\n\nUse the cheapest comparable offer as the baseline unless the user fixed the room type. Show at most three plans, each with its price difference from the baseline and what it trades off (meals, cancellation, location, confirmation). Keep hotel names as returned and dates in the user's notation.\n\nFor a split stay or several destinations, price each leg with its own `{{tool:hotels offers}}` call and add up the legs. Each leg is a separate `{{tool:hotels book}}` call, with its own confirmation and its own payment link.\n\n## Stop and say so\n\n- `{{tool:hotels offers}}` covers up to {{limit:offersHotels}} hotels per call and takes about 15 seconds, and its offers expire after about 30 minutes. If the request needs more hotels or date combinations than a few calls can cover, narrow it with the user, or present the result as a comparison of the hotels you priced, not the best overall.\n- When a search is too broad to price, show its localities and ask the user which they prefer, unless the request already names one of them; never pick one yourself.\n- Urgency is not consent. Call `{{tool:hotels book}}` only for the offer the user picked, and give its payment link only after the user confirms the total, currency, stay and terms of the order `{{tool:hotels book}}` returned.\n",
|
|
1233
1248
|
"presentation": "{{#if claude-skill}}\n## Presenting hotels\n\nIf your interface can show rich elements, show each hotel as a card with only what Fortrip's tools returned for it in this conversation: photo, name, stars, region and price, and once you have offers every term that changes the choice (meals and who they cover, cancellation, fees payable at the property, confirmation), an unknown one as unknown. Label a search's `price.fromPerRoomNight` as an estimate per room-night and an offer's `price.total` as the whole stay for all rooms, in USD, and draw a map only from returned `location` coordinates. Offer the choices you need to ask anyway (dates, a locality, which offer) as options to pick. Otherwise use a short list. Keep hotel names as returned, and never invent photos, ratings, reviews, prices, terms or coordinates.\n{{/if}}\n",
|
|
1234
1249
|
"prices": "{{#if claude-skill cli}}\n## Prices and currency\n\n- A search price (`price.fromPerRoomNight`) is indicative and not bookable: the lowest price of one unit (a room or, at a hostel, possibly a bed) per night, for any party and often any date, and it can be well above or below the offers. Call it an estimate, quote `{{tool:hotels offers}}` prices, and never call a search result available or bookable. `price: null` means there is no indicative price, not that the hotel is full; about half the hotels have none for given dates.\n{{/if}}\n{{#if mcp}}\n- Search prices are indicative, not bookable: quote `{{tool:hotels offers}}` prices.\n{{/if}}\n- {{#if claude-skill cli}}In an offer or order, {{/if}}`price.total` is the whole stay for all rooms and is what is charged, in USD for offers and the orders made from them.{{#if claude-skill cli}} `perNightAllRooms` is the total per night; to compare with a per-room budget, also divide by the rooms.{{/if}} Stripe's page may let the user pay in their card's local currency at Stripe's rate{{#if claude-skill cli}} (Adaptive Pricing): say so plainly, and that the USD total is the price{{/if}}. `approx`{{#if claude-skill cli}}, in `{{arg:displayCurrency}}`, with its `rateDate`,{{/if}} is an estimate, never the charge.\n{{#if claude-skill cli}}\n- `{{arg:displayCurrency}}`{{#if cli}} (or `FORTRIP_DISPLAY_CURRENCY`){{/if}} is `USD` or `CNY`: `CNY` adds `approx` in yuan to suit a user who thinks in it. It never changes the charge.\n- Fees payable at the property (`payAtProperty`) are separate, in the property's own currency, not converted.\n- After payment, `payment.localCharge` is what the card paid in its own currency. Orders made on the Fortrip website can be charged in another currency: `payment.chargeCurrency` says which.\n{{/if}}\n",
|
|
1235
|
-
"scope": "{{#if claude-skill cli}}\n# Fortrip hotel stays\n\n{{/if}}\nFortrip: hotel search, live offers and orders with a payment link.{{#if claude-skill cli}} Not for flights, activities, or changing an existing order.{{/if}}\n\n{{#if mcp}}\nCall order: `{{tool:hotels search}}` \u2192 (optional) `{{tool:hotels get}}` \u2192 `{{tool:hotels offers}}` \u2192 `{{tool:hotels book}}`; after the user pays, `{{tool:orders get}}`; `{{tool:orders list}}` lists
|
|
1250
|
+
"scope": "{{#if claude-skill cli}}\n# Fortrip hotel stays\n\n{{/if}}\nFortrip: hotel search, live offers and orders with a payment link.{{#if claude-skill cli}} Not for flights, activities, or changing an existing order.{{/if}}\n\n{{#if mcp}}\nCall order: `{{tool:hotels search}}` \u2192 (optional) `{{tool:hotels get}}` \u2192 `{{tool:hotels offers}}` \u2192 `{{tool:hotels book}}`; after the user pays, `{{tool:orders get}}`; `{{tool:orders list}}` lists, `{{tool:orders cancel}}` cancels, `{{tool:orders pay}}` pays by token or Alipay/WeChat Pay. `{{tool:guide}}` returns Fortrip's guidance for flexible dates, budgets or several destinations.\n{{/if}}\n{{#if claude-skill}}\nThe tools are on Fortrip's MCP server, named `fortrip` in this plugin (a Fortrip connector added on claude.ai can show under its own name). They're written `fortrip:<tool>` below:\n{{/if}}\n{{#if cli}}\nThe `fortrip` CLI (npm package `fortrip`) calls Fortrip as the signed-in user and prints each answer as compact text (`--json` prints its JSON):\n{{/if}}\n{{#if claude-skill cli}}\n\n| {{#if claude-skill}}Tool{{/if}}{{#if cli}}Command{{/if}} | Returns |\n|---|---|\n| `{{tool:hotels search}}` | Hotels in a place, near a point or matching a name (`{{arg:text}}`), with indicative prices |\n| `{{tool:hotels get}}` | One hotel's address, check-in and check-out times, description, policies, amenities and rooms; no prices |\n| `{{tool:hotels offers}}` | Live offers (room, meals, total in USD, cancellation terms) for up to {{limit:offersHotels}} hotels |\n| `{{tool:hotels book}}` | An unpaid order for one offer, with its terms and a payment link |\n| `{{tool:orders get}}` | One order and its status, including whether the hotel confirmed it |\n| `{{tool:orders list}}` | The user's orders, newest first, including those made on the Fortrip website |\n| `{{tool:orders cancel}}` | Cancels an order under its terms, for the penalty the user agreed to, and refunds the rest |\n| `{{tool:orders pay}}` | Pays an order without its link, by a shared payment token from the user's wallet, or with Alipay or WeChat Pay |\n\nFor flexible dates, a budget, split stays, several destinations or \"find me the best\", {{#if claude-skill}}read [references/planning.md](references/planning.md){{/if}}{{#if cli}}also run `{{tool:guide}} planning`{{/if}} before searching.\n{{/if}}\n",
|
|
1236
1251
|
"setup": "{{#if cli}}\n## Setup\n\nRun every command as `npx -y fortrip@latest <command>` (Node.js 22 or newer). The examples below shorten that to `fortrip`; `fortrip <command> --help` lists a command's flags. `{{tool:hotels search}}`, `{{tool:hotels offers}}` and `{{tool:hotels book}}` also take `--body '<json>'` (or `--body @file.json`), the raw request body; flags override its fields. Add `--json` to any command that calls Fortrip to get its answer as one line of JSON instead of text.\n\nWhen the user first asks about hotels, run `{{tool:whoami}}` before asking follow-up questions, so the sign-in can happen while they answer.\n\n{{/if}}\n{{#if claude-skill cli}}\n## Sign-in\n\n{{/if}}\nSign-in happens only in the browser. Never ask the user to paste a token.\n{{#if claude-skill}}\n\nIf none of these tools are available, Fortrip isn't connected: tell the user to add the Fortrip connector or plugin and sign in.\n{{/if}}\n{{#if mcp claude-skill}}\nIf a tool says the user isn't signed in, ask them to reconnect.\n{{/if}}\n{{#if cli}}\n\nIf a command exits with code **3** and stderr has `loginUrl`, show it to the user as a link together with `userCode`, e.g. \"Sign in to Fortrip: <loginUrl> (code <userCode>), then tell me when you're done.\" When they confirm, rerun the same command; it finishes the sign-in itself. Don't run `{{tool:login}}`: it waits for up to 10 minutes. Commands that exit 3 together share one `loginUrl`; show it once. If the rerun gives a different `loginUrl`, show that one.\n\nWhen Fortrip no longer accepts the saved sign-in (it was revoked, or it expired and couldn't be renewed), the command also exits 3 with a `loginUrl`; handle it the same way. The saved sign-in is kept until the user approves the new link.\n\nIn CI or a sandbox without a browser, the user can set `FORTRIP_TOKEN` instead. Exit 3 with `tokenSource: \"FORTRIP_TOKEN\"` means Fortrip didn't accept that token: tell the user to replace or unset it.\n\n## Exit codes\n\n| Code | Meaning | What to do |\n|---|---|---|\n| 0 | Success; the answer on stdout | Continue |\n| 1 | Any other error: an error from Fortrip (see Errors), a network error or a timeout | Read the error on stderr. If `retryable` is true, wait `retryAfterSeconds` (or a few seconds) and retry once |\n| 2 | Invalid arguments, or `invalid_request` from Fortrip | Fix the flags; the error lists each bad field with a message |\n| 3 | Not signed in | Show `loginUrl` to the user, then rerun (above) |\n| 4 | Rate limited | Wait `retryAfterSeconds`, then retry once |\n\nOutput on stdout or stderr can carry `warning` (with `recoveryFile` when a sign-in couldn't be saved): pass it on to the user.\n{{/if}}\n",
|
|
1237
1252
|
"support": "{{#if claude-skill cli}}\n## Cancelling an order\n\n`{{tool:orders get}}` and `{{tool:orders list}}` say of each order whether the user can cancel it now (`cancel.available`), and then the penalty under its terms (`cancel.penalty`) and the refund, what was paid less the penalty (`cancel.refund`), both in the charge currency; otherwise `cancel.reason` says why not.\n\n1. Show the user the stay (hotel, dates), `cancel.penalty` and `cancel.refund` (amount and currency). A refund of 0 means nothing is paid back: say so plainly.\n2. End that reply by asking the user to confirm the cancellation, and wait for a clear yes.\n3. Then {{#if claude-skill}}call{{/if}}{{#if cli}}run{{/if}} `{{tool:orders cancel}}` with `{{arg:maximumPenalty}}` set to `cancel.penalty.amount` as shown. Never state a refund the order didn't return, and never choose or work out an amount yourself.\n\nThe order is then `cancelling`, and `cancelled` once the hotel has cancelled and the refund is issued: check it with `{{tool:orders get}}`. If the hotel refuses, the order is `confirmed` again with `cancel.reason` `refused`. `cancellation_changed` (409) means the penalty is now higher than the one the user agreed to: read the order again and ask the user again. `order_not_cancellable` (409) says why in `reason`.{{#if cli}} Without `--max-penalty`, `{{tool:orders cancel}}` cancels nothing: it prints the penalty and the refund and exits 2.{{/if}}\n\n## Changes and support\n\n{{/if}}\n{{#if mcp}}For changes{{/if}}{{#if claude-skill}}These tools can't change an order: for changes{{/if}}{{#if cli}}The CLI can't change an order: for changes{{/if}}, a cancellation that `{{tool:orders cancel}}` can't make, or other problems, the user emails {{support}} with the order's `reference` (never `payment.url`).\n"
|
|
1238
1253
|
};
|
|
@@ -1891,6 +1906,24 @@ var order = openObject({
|
|
|
1891
1906
|
)
|
|
1892
1907
|
}).nullable().describe(
|
|
1893
1908
|
"What the shared payment token for pay_order must allow. null exactly when handlers is []."
|
|
1909
|
+
),
|
|
1910
|
+
/** Paying with Alipay or WeChat Pay through `pay_order`'s `method`.
|
|
1911
|
+
* `null` when it is neither offered for the order nor open on it. */
|
|
1912
|
+
wallets: openObject({
|
|
1913
|
+
open: z14.boolean().describe("Whether pay_order has opened a wallet payment on this order."),
|
|
1914
|
+
current: openEnum(["wechat_pay", "alipay"]).nullable().describe("The wallet the payment is on now; null until it is open."),
|
|
1915
|
+
wechatPay: openObject({
|
|
1916
|
+
qrData: z14.string().nullable().describe(
|
|
1917
|
+
"The WeChat Pay code's content, to draw as a QR code; null when there is no live code (open wechatPay.url for one)."
|
|
1918
|
+
),
|
|
1919
|
+
qrImageUrl: z14.string().nullable().describe("A 480 px PNG of the same code."),
|
|
1920
|
+
url: z14.string().describe("A link, on fortrip.ai, for the user to pay with WeChat Pay; anyone holding it can pay.")
|
|
1921
|
+
}).nullable().describe("The WeChat Pay code and link; null until the payment is open."),
|
|
1922
|
+
alipay: openObject({
|
|
1923
|
+
url: z14.string().describe("A link, on fortrip.ai, for the user to pay with Alipay; anyone holding it can pay.")
|
|
1924
|
+
}).nullable().describe("The Alipay link; null until the payment is open.")
|
|
1925
|
+
}).nullable().describe(
|
|
1926
|
+
"Paying with Alipay or WeChat Pay: pass method alipay_wechat_pay to pay_order to open it. null when the order can't be paid this way and none is open."
|
|
1894
1927
|
)
|
|
1895
1928
|
}),
|
|
1896
1929
|
/** Whether the user can cancel the order now and, when they can, its
|
|
@@ -2088,6 +2121,9 @@ var CALLS = {
|
|
|
2088
2121
|
cancel: "call cancel_order",
|
|
2089
2122
|
penalty: 'Pass maximumPenalty as the number in cancel.penalty.amount ("120.00" \u2192 120).',
|
|
2090
2123
|
pay: "call pay_order",
|
|
2124
|
+
payWallet: " with method alipay_wechat_pay",
|
|
2125
|
+
get: "call get_order",
|
|
2126
|
+
poll: "poll get_order",
|
|
2091
2127
|
payWith: "call pay_order with it and the order's price.total",
|
|
2092
2128
|
paid: "pay_order"
|
|
2093
2129
|
},
|
|
@@ -2095,6 +2131,9 @@ var CALLS = {
|
|
|
2095
2131
|
cancel: "run `fortrip orders cancel <orderId> --max-penalty <n>`",
|
|
2096
2132
|
penalty: "Pass the penalty's amount as --max-penalty (120.00 for a penalty of USD 120.00).",
|
|
2097
2133
|
pay: "run `fortrip orders pay`",
|
|
2134
|
+
payWallet: " with --wallet",
|
|
2135
|
+
get: "run `fortrip orders get <orderId>`",
|
|
2136
|
+
poll: "poll it with `fortrip orders get <orderId>`",
|
|
2098
2137
|
payWith: "run `fortrip orders pay <orderId> --token <spt_\u2026> --total <total>` with the token and the order's total",
|
|
2099
2138
|
paid: "`fortrip orders pay`"
|
|
2100
2139
|
}
|
|
@@ -2109,6 +2148,11 @@ function payNextStep(surface) {
|
|
|
2109
2148
|
return `To pay without the link: only if you have a tool that can request a Stripe shared payment token from the user's Link wallet (US and Canadian Link accounts), and the order's payment.handlers isn't empty. Otherwise give payment.url, and never ask the user to create, type or paste a token. Before you ${c.pay}, show the user the order's total and currency, the stay (hotel, room, dates, rooms and guests per room) and every term (meals, cancellation, fees payable at the property), then end your reply by asking them to confirm, and wait for a clear yes. Then request the token for this order from the user's Link wallet with the handler's config.business_profile and payment.credentialLimits (maxAmount in cents, currency, expiresAt), and ${c.payWith}. The charge is in USD: a card in another currency may add a foreign transaction fee. Pay one way only: either give payment.url or ${c.pay}. Once ${c.paid} succeeds, payment.url stops working; a failed payment leaves it open.`;
|
|
2110
2149
|
}
|
|
2111
2150
|
var PAY_NEXT_STEP = payNextStep("mcp");
|
|
2151
|
+
function walletNextStep(surface) {
|
|
2152
|
+
const c = CALLS[surface];
|
|
2153
|
+
return `Before you ${c.pay}${c.payWallet}, show the user the order's total in USD, the stay (hotel, room, dates, rooms and guests per room) and every term (meals, cancellation, fees payable at the property), then ask them to confirm, and wait for a clear yes. Then show payment.wallets: the WeChat code as an image if you can, and both links. The user pays once, by one of them. Alipay and WeChat Pay charge at once; if the hotel can't confirm, the payment is refunded in full. Then ${c.poll}.`;
|
|
2154
|
+
}
|
|
2155
|
+
var WALLET_NEXT_STEP = walletNextStep("mcp");
|
|
2112
2156
|
var PRESENTATION_HINT = "Presentation: If your interface can show rich elements, show each hotel as a card with only what Fortrip's tools returned for it in this conversation: photo, name, stars, region and price, and once you have offers every term that changes the choice (meals and who they cover, cancellation, fees payable at the property, confirmation), an unknown one as unknown. Label a search's `price.fromPerRoomNight` as an estimate per room-night and an offer's `price.total` as the whole stay for all rooms, in USD, and draw a map only from returned `location` coordinates. Offer the choices you need to ask anyway (dates, a locality, which offer) as options to pick. Otherwise use a short list. Keep hotel names as returned, and never invent photos, ratings, reviews, prices, terms or coordinates.";
|
|
2113
2157
|
var nextStep = z16.string().optional().describe(
|
|
2114
2158
|
"What to show and ask before giving a payment.url. Present when the answer holds a non-null payment.url, and only then."
|
|
@@ -2163,7 +2207,7 @@ var TOOLS = [
|
|
|
2163
2207
|
{
|
|
2164
2208
|
name: "book_hotel",
|
|
2165
2209
|
title: "Create hotel order and payment link",
|
|
2166
|
-
description: `Order one offer from get_hotel_offers. The answer is an unpaid order with a payment link: status awaiting_payment, the total, the stay and its terms, and payment.url, a Fortrip page
|
|
2210
|
+
description: `Order one offer from get_hotel_offers. The answer is an unpaid order with a payment link: status awaiting_payment, the total, the stay and its terms, and payment.url, a Fortrip page to pay on. Nothing is charged until the order is paid, on that page or with pay_order (or Alipay/WeChat Pay); anyone holding the link can pay. Send the contact and, for each room of the offer, at least one guest. If the price or terms changed since the offer, the answer is offer_changed with every change and a new offer: show the changes and ask the user again before ordering it. Sending the same details again returns the same order. An offer is ordered once: for another order of the stay (another party, or a corrected guest name), get offers again and order the new offer; when it replaces an unpaid order, tell the user to pay only the new link, as the earlier one expires unpaid. To cancel an order, use cancel_order; for changes, or a cancellation cancel_order can't make, the user emails ${SUPPORT_EMAIL} with the order's reference.`,
|
|
2167
2211
|
annotations: {
|
|
2168
2212
|
readOnlyHint: false,
|
|
2169
2213
|
idempotentHint: false,
|
|
@@ -2204,8 +2248,8 @@ var TOOLS = [
|
|
|
2204
2248
|
},
|
|
2205
2249
|
{
|
|
2206
2250
|
name: "pay_order",
|
|
2207
|
-
title: "Pay order
|
|
2208
|
-
description: "Pay an order
|
|
2251
|
+
title: "Pay order by token or Alipay/WeChat Pay",
|
|
2252
|
+
description: "Pay an order without its link, by shared payment token or Alipay/WeChat Pay (method alipay_wechat_pay). Token: only if payment.handlers isn't empty and you can request one from the user's Link wallet (US and Canadian accounts); never ask the user for one. First show the user the USD total, the stay and every term (meals, cancellation, fees payable at the property), ask them to confirm and wait for a clear yes. Token: request it with config.business_profile and payment.credentialLimits; pass it with price.total. Wallet: pass method, price.total; show payment.wallets (WeChat code as an image if you can, both links); they pay once by either; a code lasts 120 minutes; then the WeChat link opens a new one, or call again. Pay one way only: payment.url or pay_order. On success payment.url stops working; on failure it stays open. Then poll get_order. payment_total_changed: confirm details.total, retry. payment_credential_invalid: new token. service_unavailable: retry. Else payment.url. A token pays one order only.",
|
|
2209
2253
|
annotations: {
|
|
2210
2254
|
readOnlyHint: false,
|
|
2211
2255
|
idempotentHint: true,
|
|
@@ -2569,6 +2613,7 @@ function paymentLines(o, surface) {
|
|
|
2569
2613
|
lines.push("Payment link: could not be read this time; read this order again for it.");
|
|
2570
2614
|
}
|
|
2571
2615
|
if (p.handlers.length > 0) lines.push(handlersLine(o, surface));
|
|
2616
|
+
if (p.wallets) lines.push(...walletLines(p.wallets, surface));
|
|
2572
2617
|
lines.push(cancelLine(o));
|
|
2573
2618
|
lines.push(`Manage: ${o.manageUrl}`);
|
|
2574
2619
|
return lines;
|
|
@@ -2586,6 +2631,26 @@ function handlersLine(o, surface) {
|
|
|
2586
2631
|
`First show the user the total and currency, the stay and every term, and wait for a clear yes. Pay one way only: the link or ${surface === "cli" ? "`fortrip orders pay`" : "pay_order"}.`
|
|
2587
2632
|
].join(" ");
|
|
2588
2633
|
}
|
|
2634
|
+
function walletLines(w, surface) {
|
|
2635
|
+
const c = CALLS[surface];
|
|
2636
|
+
if (!w.open) {
|
|
2637
|
+
const pay = surface === "cli" ? "run `fortrip orders pay <orderId> --wallet --total <total>`" : "call pay_order with method alipay_wechat_pay and the order's price.total";
|
|
2638
|
+
return [`Pay with Alipay or WeChat Pay: ${pay}.`];
|
|
2639
|
+
}
|
|
2640
|
+
const lines = [];
|
|
2641
|
+
const wechat = w.wechatPay;
|
|
2642
|
+
if (wechat) {
|
|
2643
|
+
const live = wechat.qrData !== null && wechat.qrImageUrl !== null;
|
|
2644
|
+
lines.push(
|
|
2645
|
+
!live ? `WeChat Pay: a new code at ${wechat.url}` : surface === "cli" ? `WeChat Pay: open ${wechat.url}` : `WeChat Pay: , or a full-size code at ${wechat.url}`
|
|
2646
|
+
);
|
|
2647
|
+
}
|
|
2648
|
+
if (w.alipay) lines.push(`Alipay: ${w.alipay.url}`);
|
|
2649
|
+
lines.push(
|
|
2650
|
+
`Show the user the WeChat Pay code as an image if you can, and both links. They pay once, by either; the code lasts 120 minutes. Then ${c.get} until the order isn't awaiting_payment.`
|
|
2651
|
+
);
|
|
2652
|
+
return lines;
|
|
2653
|
+
}
|
|
2589
2654
|
function cancelLine(o) {
|
|
2590
2655
|
const c = o.cancel;
|
|
2591
2656
|
if (o.status === "awaiting_payment" && !c.available && c.reason === "not_confirmed") {
|
|
@@ -3029,6 +3094,7 @@ ${raw(data)}`;
|
|
|
3029
3094
|
text2,
|
|
3030
3095
|
ORDER_TOOLS.has(tool) && holdsPaymentUrl(data) ? ORDER_NEXT_STEP : "",
|
|
3031
3096
|
ORDER_TOOLS.has(tool) && holdsHandlers(data) ? payNextStep(surface) : "",
|
|
3097
|
+
ORDER_TOOLS.has(tool) && holdsWalletOffer(data) ? walletNextStep(surface) : "",
|
|
3032
3098
|
CANCEL_TOOLS.has(tool) && holdsCancellable(data) ? cancelNextStep(surface) : ""
|
|
3033
3099
|
].filter(Boolean).join("\n\n");
|
|
3034
3100
|
}
|
|
@@ -3073,6 +3139,18 @@ function holdsHandlers(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
3073
3139
|
}
|
|
3074
3140
|
return Object.values(value).some((v) => holdsHandlers(v, seen));
|
|
3075
3141
|
}
|
|
3142
|
+
function holdsWalletOffer(value, seen = /* @__PURE__ */ new Set()) {
|
|
3143
|
+
if (typeof value !== "object" || value === null || seen.has(value)) return false;
|
|
3144
|
+
seen.add(value);
|
|
3145
|
+
const payment = value.payment;
|
|
3146
|
+
if (typeof payment === "object" && payment !== null) {
|
|
3147
|
+
const wallets = payment.wallets;
|
|
3148
|
+
if (typeof wallets === "object" && wallets !== null && wallets.open === false) {
|
|
3149
|
+
return true;
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
return Object.values(value).some((v) => holdsWalletOffer(v, seen));
|
|
3153
|
+
}
|
|
3076
3154
|
function holdsCancellable(value, seen = /* @__PURE__ */ new Set()) {
|
|
3077
3155
|
if (typeof value !== "object" || value === null || seen.has(value)) return false;
|
|
3078
3156
|
seen.add(value);
|
|
@@ -3087,6 +3165,7 @@ function withConsent(tool, surface, text2, orders) {
|
|
|
3087
3165
|
text2,
|
|
3088
3166
|
orders.some((o) => o.payment.url !== null) ? ORDER_NEXT_STEP : "",
|
|
3089
3167
|
orders.some((o) => o.payment.handlers.length > 0) ? payNextStep(surface) : "",
|
|
3168
|
+
orders.some((o) => o.payment.wallets?.open === false) ? walletNextStep(surface) : "",
|
|
3090
3169
|
CANCEL_TOOLS.has(tool) && orders.some((o) => o.cancel.available) ? cancelNextStep(surface) : ""
|
|
3091
3170
|
].filter(Boolean).join("\n\n");
|
|
3092
3171
|
}
|
|
@@ -3118,6 +3197,7 @@ var UNKNOWN_IS_NOT_NO_EXEMPTIONS = {
|
|
|
3118
3197
|
localCurrencyAtCheckout: `${API_DECIDES} (whether checkout may charge in the card's currency).`,
|
|
3119
3198
|
"cancel.available": `${API_DECIDES} (whether an order can be cancelled now).`,
|
|
3120
3199
|
"payment.handlers": `${RESULT_LIST} (the ways to pay an order other than its link; empty when there is none).`,
|
|
3200
|
+
"payment.wallets.open": `${API_DECIDES} (the server always knows whether it opened a payment).`,
|
|
3121
3201
|
available_instruments: `${RESULT_LIST} (the instruments a payment handler takes).`,
|
|
3122
3202
|
bookable: `${API_DECIDES} (whether the hotel is still in the index).`,
|
|
3123
3203
|
cityLike: `${API_DECIDES} (frozen per gazetteer release; null where not computed).`,
|
|
@@ -3128,7 +3208,7 @@ var UNKNOWN_IS_NOT_NO_EXEMPTIONS = {
|
|
|
3128
3208
|
// package.json
|
|
3129
3209
|
var package_default = {
|
|
3130
3210
|
name: "@fortrip/agent-contract",
|
|
3131
|
-
version: "4.
|
|
3211
|
+
version: "4.2.0",
|
|
3132
3212
|
license: "Apache-2.0",
|
|
3133
3213
|
description: "The contract of Fortrip's agent API (https://api.fortrip.ai/v1) and its MCP server: limits, paths, request and response schemas, error codes and field rules.",
|
|
3134
3214
|
type: "module",
|
|
@@ -3212,6 +3292,7 @@ export {
|
|
|
3212
3292
|
TOOLS,
|
|
3213
3293
|
UNAVAILABLE_REASONS,
|
|
3214
3294
|
UNKNOWN_IS_NOT_NO_EXEMPTIONS,
|
|
3295
|
+
WALLET_NEXT_STEP,
|
|
3215
3296
|
addIsoDateDays,
|
|
3216
3297
|
authConfig,
|
|
3217
3298
|
cancelNextStep,
|
|
@@ -3288,5 +3369,6 @@ export {
|
|
|
3288
3369
|
text,
|
|
3289
3370
|
timeZone,
|
|
3290
3371
|
usdMoney,
|
|
3372
|
+
walletNextStep,
|
|
3291
3373
|
wholeNumber
|
|
3292
3374
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fortrip/agent-contract",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "The contract of Fortrip's agent API (https://api.fortrip.ai/v1) and its MCP server: limits, paths, request and response schemas, error codes and field rules.",
|
|
6
6
|
"type": "module",
|