@agenzo/merchant-cli 0.9.4 → 0.9.5
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/dist/index.js +489 -107
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -850,6 +850,12 @@ function render(result, opts) {
|
|
|
850
850
|
process.stdout.write(`${result.text()}
|
|
851
851
|
`);
|
|
852
852
|
}
|
|
853
|
+
function notify(format, type, message) {
|
|
854
|
+
if (format === "json") {
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
console.error(Formatter.status(type, message));
|
|
858
|
+
}
|
|
853
859
|
async function renderWithContext(result, opts, configManager) {
|
|
854
860
|
if (opts.format !== "json") {
|
|
855
861
|
render(result, opts);
|
|
@@ -1434,6 +1440,123 @@ var rideTripStatusSchema = {
|
|
|
1434
1440
|
BOOKING_FAILED: "Transient upstream error. Retry once after 5s, or fall back to `ride-elife get` for whole-ride status."
|
|
1435
1441
|
}
|
|
1436
1442
|
};
|
|
1443
|
+
var RIDE_ORDER_ID_FLAG = {
|
|
1444
|
+
type: "string",
|
|
1445
|
+
required: true,
|
|
1446
|
+
description: "The numeric ride_id returned by book (NOT the rio_... order_id)"
|
|
1447
|
+
};
|
|
1448
|
+
var CALLBACK_IDEMPOTENCY_FLAG = {
|
|
1449
|
+
type: "string",
|
|
1450
|
+
required: true,
|
|
1451
|
+
description: "Unique key (1-128 chars [A-Za-z0-9_-]) forwarded verbatim as the Idempotency-Key header; never auto-generated"
|
|
1452
|
+
};
|
|
1453
|
+
var CALLBACK_SUBSCRIPTION_FLAGS = {
|
|
1454
|
+
"callback-url": { type: "string", required: true, description: "https URL that receives status events; internal addresses are rejected by the platform" },
|
|
1455
|
+
adapter: { type: "string", required: false, default: "techtanium_v1", description: "Outbound event shape" },
|
|
1456
|
+
"signature-mode": { type: "string", required: false, default: "off", description: "off / optional / required" },
|
|
1457
|
+
"callback-api-key": { type: "string", required: false, description: "API key sent to your endpoint; omit to keep the stored one (never echoed back)" },
|
|
1458
|
+
"rotate-secret": { type: "bool", required: false, default: false, description: "Issue a new signing secret; the old one stops verifying" },
|
|
1459
|
+
"idempotency-key": CALLBACK_IDEMPOTENCY_FLAG
|
|
1460
|
+
};
|
|
1461
|
+
var CALLBACK_SUBSCRIPTION_RESPONSE = {
|
|
1462
|
+
callback_url: { type: "string", description: "Registered destination" },
|
|
1463
|
+
adapter: { type: "string", description: "Outbound event shape" },
|
|
1464
|
+
signature_mode: { type: "string", description: "off / optional / required" },
|
|
1465
|
+
status: { type: "string", description: "Registration status" },
|
|
1466
|
+
callback_secret: { type: "string", description: "Signing secret \u2014 present ONLY in the set response that issued it; store it, it cannot be read back" }
|
|
1467
|
+
};
|
|
1468
|
+
var CALLBACK_ERRORS = {
|
|
1469
|
+
RIDE_NOT_FOUND: "The ride is not yours or does not exist; check the ride_id from book/list-orders.",
|
|
1470
|
+
PARAM_INVALID: "Fix the flag named in the message (https URL, signature-mode, ranges) and retry.",
|
|
1471
|
+
PARAM_IDEMPOTENCY_KEY_REQUIRED: "Supply --idempotency-key (1-128 chars [A-Za-z0-9_-]); the CLI never generates one under --yes."
|
|
1472
|
+
};
|
|
1473
|
+
var rideCallbackSetSchema = {
|
|
1474
|
+
cli: CLI_NAME,
|
|
1475
|
+
noun: NOUN,
|
|
1476
|
+
verb: "callback-set",
|
|
1477
|
+
description: "Register (or update) where one ride's status events are forwarded; takes priority over the default",
|
|
1478
|
+
flags: { "order-id": RIDE_ORDER_ID_FLAG, ...CALLBACK_SUBSCRIPTION_FLAGS },
|
|
1479
|
+
response: { ride_id: { type: "string|int", description: "Ride id" }, order_id: { type: "string", description: "rio_... order id" }, ...CALLBACK_SUBSCRIPTION_RESPONSE },
|
|
1480
|
+
example: {
|
|
1481
|
+
command: "agenzo-merchant-cli ride-elife callback-set --order-id 4112961 --callback-url https://example.com/ride-events --idempotency-key cb-1",
|
|
1482
|
+
output_summary: "Returns the registration; the first registration also returns callback_secret once."
|
|
1483
|
+
},
|
|
1484
|
+
error_recovery: CALLBACK_ERRORS
|
|
1485
|
+
};
|
|
1486
|
+
var rideCallbackGetSchema = {
|
|
1487
|
+
cli: CLI_NAME,
|
|
1488
|
+
noun: NOUN,
|
|
1489
|
+
verb: "callback-get",
|
|
1490
|
+
description: "Show one ride's callback registration (the signing secret is never returned)",
|
|
1491
|
+
flags: { "order-id": RIDE_ORDER_ID_FLAG },
|
|
1492
|
+
response: { ride_id: { type: "string|int", description: "Ride id" }, order_id: { type: "string", description: "rio_... order id" }, ...CALLBACK_SUBSCRIPTION_RESPONSE },
|
|
1493
|
+
example: { command: "agenzo-merchant-cli ride-elife callback-get --order-id 4112961", output_summary: "Returns the registration without the secret." },
|
|
1494
|
+
error_recovery: { RIDE_NOT_FOUND: CALLBACK_ERRORS.RIDE_NOT_FOUND }
|
|
1495
|
+
};
|
|
1496
|
+
var rideCallbackDefaultSetSchema = {
|
|
1497
|
+
cli: CLI_NAME,
|
|
1498
|
+
noun: NOUN,
|
|
1499
|
+
verb: "callback-default-set",
|
|
1500
|
+
description: "Register (or update) the developer-wide fallback used by rides that have no callback of their own",
|
|
1501
|
+
flags: CALLBACK_SUBSCRIPTION_FLAGS,
|
|
1502
|
+
response: { developer_id: { type: "string", description: "Owner of the default" }, ...CALLBACK_SUBSCRIPTION_RESPONSE },
|
|
1503
|
+
example: {
|
|
1504
|
+
command: "agenzo-merchant-cli ride-elife callback-default-set --callback-url https://example.com/ride-events --idempotency-key cbd-1",
|
|
1505
|
+
output_summary: "Configure once so events for rides booked later are never dropped."
|
|
1506
|
+
},
|
|
1507
|
+
error_recovery: { PARAM_INVALID: CALLBACK_ERRORS.PARAM_INVALID, PARAM_IDEMPOTENCY_KEY_REQUIRED: CALLBACK_ERRORS.PARAM_IDEMPOTENCY_KEY_REQUIRED }
|
|
1508
|
+
};
|
|
1509
|
+
var rideCallbackDefaultGetSchema = {
|
|
1510
|
+
cli: CLI_NAME,
|
|
1511
|
+
noun: NOUN,
|
|
1512
|
+
verb: "callback-default-get",
|
|
1513
|
+
description: "Show the developer-wide fallback callback (the signing secret is never returned)",
|
|
1514
|
+
flags: {},
|
|
1515
|
+
response: { developer_id: { type: "string", description: "Owner of the default" }, ...CALLBACK_SUBSCRIPTION_RESPONSE },
|
|
1516
|
+
example: { command: "agenzo-merchant-cli ride-elife callback-default-get", output_summary: "Returns the default without the secret." }
|
|
1517
|
+
};
|
|
1518
|
+
var rideCallbackDeliveriesSchema = {
|
|
1519
|
+
cli: CLI_NAME,
|
|
1520
|
+
noun: NOUN,
|
|
1521
|
+
verb: "callback-deliveries",
|
|
1522
|
+
description: "List one ride's callback forwarding records (pending / delivered / dead)",
|
|
1523
|
+
flags: {
|
|
1524
|
+
"order-id": RIDE_ORDER_ID_FLAG,
|
|
1525
|
+
limit: { type: "int", required: false, default: 50, description: "Page size 1-100" },
|
|
1526
|
+
offset: { type: "int", required: false, default: 0, description: "Records to skip" }
|
|
1527
|
+
},
|
|
1528
|
+
response: {
|
|
1529
|
+
ride_id: { type: "string|int", description: "Ride id" },
|
|
1530
|
+
limit: { type: "int", description: "Page size used" },
|
|
1531
|
+
offset: { type: "int", description: "Offset used" },
|
|
1532
|
+
count: { type: "int", description: "Records in this page" },
|
|
1533
|
+
deliveries: { type: "array", description: "Forwarding records: event_id, status, attempts, last_error, timestamps" }
|
|
1534
|
+
},
|
|
1535
|
+
example: { command: "agenzo-merchant-cli ride-elife callback-deliveries --order-id 4112961", output_summary: "Shows what was forwarded and where it stalled." },
|
|
1536
|
+
error_recovery: { RIDE_NOT_FOUND: CALLBACK_ERRORS.RIDE_NOT_FOUND, PARAM_INVALID: CALLBACK_ERRORS.PARAM_INVALID }
|
|
1537
|
+
};
|
|
1538
|
+
var rideCallbackReplaySchema = {
|
|
1539
|
+
cli: CLI_NAME,
|
|
1540
|
+
noun: NOUN,
|
|
1541
|
+
verb: "callback-replay",
|
|
1542
|
+
description: "Requeue one ride's dead (or failed) callback records; delivered records are never re-sent",
|
|
1543
|
+
flags: {
|
|
1544
|
+
"order-id": RIDE_ORDER_ID_FLAG,
|
|
1545
|
+
"event-id": { type: "string", required: false, description: "Requeue only this record (default: all dead records)" },
|
|
1546
|
+
"include-failed": { type: "bool", required: false, default: false, description: "Also requeue pending records that already failed" },
|
|
1547
|
+
"reset-attempts": { type: "bool", required: false, default: false, description: "Reset the retry counter of requeued records" },
|
|
1548
|
+
"idempotency-key": CALLBACK_IDEMPOTENCY_FLAG
|
|
1549
|
+
},
|
|
1550
|
+
response: {
|
|
1551
|
+
ride_id: { type: "string", description: "Ride id" },
|
|
1552
|
+
requeued: { type: "int", description: "Number of records set back to pending" }
|
|
1553
|
+
},
|
|
1554
|
+
example: {
|
|
1555
|
+
command: "agenzo-merchant-cli ride-elife callback-replay --order-id 4112961 --idempotency-key rp-1",
|
|
1556
|
+
output_summary: "Requeues dead records; the delivery worker re-sends them on its next pass."
|
|
1557
|
+
},
|
|
1558
|
+
error_recovery: CALLBACK_ERRORS
|
|
1559
|
+
};
|
|
1437
1560
|
var listOrdersSchema = {
|
|
1438
1561
|
cli: CLI_NAME,
|
|
1439
1562
|
noun: NOUN,
|
|
@@ -2382,6 +2505,39 @@ var ordersPayBatchSchema = {
|
|
|
2382
2505
|
AUTHENTICATION_REQUIRED: "EVO requires cardholder 3DS: open three_ds_url, finish authentication, then replay pay-batch with the SAME idempotency-key (or use --watch to poll automatically)."
|
|
2383
2506
|
}
|
|
2384
2507
|
};
|
|
2508
|
+
var ordersGetPaymentGroupSchema = {
|
|
2509
|
+
cli: CLI_NAME,
|
|
2510
|
+
noun: ORDERS_NOUN,
|
|
2511
|
+
verb: "get-payment-group",
|
|
2512
|
+
description: "Get the status of an aggregate settlement created by `orders pay-batch` (read-only; never re-sends the payment)",
|
|
2513
|
+
flags: {
|
|
2514
|
+
"payment-group-id": { type: "string", required: true, description: "payment_group_id returned by `orders pay-batch` (1-64 chars)" }
|
|
2515
|
+
},
|
|
2516
|
+
response: {
|
|
2517
|
+
payment_group_id: { type: "string", description: "The payment group" },
|
|
2518
|
+
status: { type: "string", description: "settled | partially_settled | failed | uncertain" },
|
|
2519
|
+
currency: { type: "string", description: "ISO 4217 currency of the aggregate settlement" },
|
|
2520
|
+
total_amount: { type: "float", description: "Aggregate total in DECIMAL units" },
|
|
2521
|
+
per_order: {
|
|
2522
|
+
type: "array",
|
|
2523
|
+
description: "Per-order outcome, same shape as pay-batch",
|
|
2524
|
+
items: {
|
|
2525
|
+
order_id: { type: "string", description: "Order id" },
|
|
2526
|
+
domain: { type: "string", description: "hotel | flight | ride" },
|
|
2527
|
+
status: { type: "string", description: "confirmed | refunded | failed" },
|
|
2528
|
+
amount: { type: "float", description: "Authoritative order amount (decimal)" },
|
|
2529
|
+
refunded_amount: { type: "float", description: "Amount refunded when upstream confirmation failed" }
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
},
|
|
2533
|
+
example: {
|
|
2534
|
+
command: "agenzo-merchant-cli orders get-payment-group --payment-group-id pg_...",
|
|
2535
|
+
output_summary: "Returns the batch status and per-order results; use it instead of replaying pay-batch to check progress."
|
|
2536
|
+
},
|
|
2537
|
+
error_recovery: {
|
|
2538
|
+
PARAM_INVALID: "Pass the payment_group_id exactly as pay-batch returned it (1-64 chars)."
|
|
2539
|
+
}
|
|
2540
|
+
};
|
|
2385
2541
|
function flightSchema(verb, description, flags, response, example, extra = {}) {
|
|
2386
2542
|
return { cli: CLI_NAME, noun: FLIGHT_NOUN, verb, description, flags, response, example, ...extra };
|
|
2387
2543
|
}
|
|
@@ -2490,7 +2646,8 @@ var flightCreateOrderSchema = flightSchema(
|
|
|
2490
2646
|
"contact-region": { type: "string", required: true, description: "Contact phone country code (no +)." },
|
|
2491
2647
|
"contact-phone": { type: "string", required: true, description: "Contact phone." },
|
|
2492
2648
|
"contact-email": { type: "string", required: true, description: "Contact email." },
|
|
2493
|
-
passengers: { type: "json", required: true, description: 'JSON array of passengers. gender/id_type are STRINGS ("1"/"2"). child/infant require adult_passenger_name.' },
|
|
2649
|
+
passengers: { type: "json", required: true, description: 'JSON array of passengers. gender/id_type are STRINGS ("1"/"2"). child/infant require adult_passenger_name. A saved traveller can be passed as just {"traveller_token":"tvp_...","type":"adult"} (from token-cli travellers list); the server fills in the ID details.' },
|
|
2650
|
+
"save-travellers": { type: "bool", required: false, description: "Save the fully filled passengers of this order as frequent travellers. Set only when the user explicitly asked to save them." },
|
|
2494
2651
|
member: MEMBER_FLAG_SCHEMA,
|
|
2495
2652
|
"idempotency-key": { type: "string", required: true, description: "Forwarded verbatim as the Idempotency-Key header." }
|
|
2496
2653
|
},
|
|
@@ -3744,6 +3901,185 @@ function registerListOrdersCommand(parent, deps) {
|
|
|
3744
3901
|
});
|
|
3745
3902
|
}
|
|
3746
3903
|
|
|
3904
|
+
// src/ride-elife/callback.ts
|
|
3905
|
+
var SIGNATURE_MODES = ["off", "optional", "required"];
|
|
3906
|
+
var DELIVERIES_LIMIT_MAX = 100;
|
|
3907
|
+
function need9(value, flag) {
|
|
3908
|
+
if (value === void 0 || String(value).trim() === "") {
|
|
3909
|
+
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
3910
|
+
}
|
|
3911
|
+
return String(value);
|
|
3912
|
+
}
|
|
3913
|
+
function intFlag(value, flag, min, max) {
|
|
3914
|
+
if (value === void 0) return void 0;
|
|
3915
|
+
const parsed = Number(value);
|
|
3916
|
+
if (!Number.isInteger(parsed) || parsed < min || max !== void 0 && parsed > max) {
|
|
3917
|
+
const range = max === void 0 ? `>= ${min}` : `${min}-${max}`;
|
|
3918
|
+
throw new CliError("PARAM_INVALID", `--${flag} must be an integer ${range}.`);
|
|
3919
|
+
}
|
|
3920
|
+
return parsed;
|
|
3921
|
+
}
|
|
3922
|
+
async function apiKeyOf(opts) {
|
|
3923
|
+
return PromptEngine.resolveInput(opts.apiKey, {
|
|
3924
|
+
message: "API Key:",
|
|
3925
|
+
type: "password"
|
|
3926
|
+
});
|
|
3927
|
+
}
|
|
3928
|
+
function subscriptionBody(opts) {
|
|
3929
|
+
const body = { callback_url: need9(opts.callbackUrl, "callback-url") };
|
|
3930
|
+
if (opts.adapter !== void 0) body.adapter = need9(opts.adapter, "adapter");
|
|
3931
|
+
if (opts.signatureMode !== void 0) {
|
|
3932
|
+
const mode = String(opts.signatureMode);
|
|
3933
|
+
if (!SIGNATURE_MODES.includes(mode)) {
|
|
3934
|
+
throw new CliError("PARAM_INVALID", `--signature-mode must be one of ${SIGNATURE_MODES.join(" / ")}.`);
|
|
3935
|
+
}
|
|
3936
|
+
body.signature_mode = mode;
|
|
3937
|
+
}
|
|
3938
|
+
if (opts.callbackApiKey !== void 0) body.callback_api_key = String(opts.callbackApiKey);
|
|
3939
|
+
if (opts.rotateSecret) body.rotate_secret = true;
|
|
3940
|
+
return body;
|
|
3941
|
+
}
|
|
3942
|
+
function formatSubscription(data) {
|
|
3943
|
+
const lines = [];
|
|
3944
|
+
for (const key of ["ride_id", "order_id", "developer_id", "callback_url", "adapter", "signature_mode", "status"]) {
|
|
3945
|
+
if (data[key] !== void 0 && data[key] !== null) lines.push([key, String(data[key])]);
|
|
3946
|
+
}
|
|
3947
|
+
const out = [Formatter.keyValue(lines)];
|
|
3948
|
+
if (typeof data.callback_secret === "string" && data.callback_secret) {
|
|
3949
|
+
out.push("", Formatter.keyValue([["callback_secret", data.callback_secret]]));
|
|
3950
|
+
out.push("Save this signing secret now \u2014 it is shown only once and cannot be read back.");
|
|
3951
|
+
}
|
|
3952
|
+
return out.join("\n");
|
|
3953
|
+
}
|
|
3954
|
+
async function render2(data, text, format) {
|
|
3955
|
+
const commandResult = { data, text };
|
|
3956
|
+
await renderWithContext(commandResult, { format }, new ConfigManager());
|
|
3957
|
+
}
|
|
3958
|
+
function withSubscriptionFlags(cmd) {
|
|
3959
|
+
return cmd.option("--callback-url <url>", "https URL that receives ride status events (must not be an internal address)").option("--adapter <name>", "Outbound event shape (default techtanium_v1)").option("--signature-mode <mode>", "off / optional / required (default off)").option("--callback-api-key <key>", "API key the platform sends to your endpoint; omit to keep the stored one").option("--rotate-secret", "Issue a new HMAC signing secret (breaks verification with the old one)").option("--idempotency-key <key>", "Idempotency key forwarded verbatim as the Idempotency-Key header");
|
|
3960
|
+
}
|
|
3961
|
+
async function postSubscription(deps, cmd, path, commandPath, doneMessage) {
|
|
3962
|
+
const opts = cmd.optsWithGlobals();
|
|
3963
|
+
const format = resolveFormat(opts.format);
|
|
3964
|
+
const target = path(opts);
|
|
3965
|
+
const body = subscriptionBody(opts);
|
|
3966
|
+
const apiKey = await apiKeyOf(opts);
|
|
3967
|
+
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
3968
|
+
yes: Boolean(opts.yes),
|
|
3969
|
+
commandPath
|
|
3970
|
+
});
|
|
3971
|
+
const result = await deps.apiClient.post(
|
|
3972
|
+
target,
|
|
3973
|
+
{ type: "api-key", key: apiKey },
|
|
3974
|
+
body,
|
|
3975
|
+
{ "Idempotency-Key": idempotencyKey }
|
|
3976
|
+
);
|
|
3977
|
+
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
3978
|
+
notify(format, "success", doneMessage);
|
|
3979
|
+
await render2(result.data, () => formatSubscription(result.data), format);
|
|
3980
|
+
}
|
|
3981
|
+
async function getJson(deps, cmd, path, text, params) {
|
|
3982
|
+
const opts = cmd.optsWithGlobals();
|
|
3983
|
+
const format = resolveFormat(opts.format);
|
|
3984
|
+
const target = path(opts);
|
|
3985
|
+
const query = params?.(opts);
|
|
3986
|
+
const apiKey = await apiKeyOf(opts);
|
|
3987
|
+
const result = await deps.apiClient.get(target, { type: "api-key", key: apiKey }, query);
|
|
3988
|
+
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
3989
|
+
await render2(result.data, () => text(result.data), format);
|
|
3990
|
+
}
|
|
3991
|
+
var ridePath = (opts, suffix) => `/ride/${encodeURIComponent(need9(opts.orderId, "order-id"))}/callback${suffix}`;
|
|
3992
|
+
function registerRideCallbackCommands(parent, deps) {
|
|
3993
|
+
const set = withSubscriptionFlags(
|
|
3994
|
+
parent.command("callback-set").description("Register (or update) where one ride's status events are forwarded").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-id <id>", "The numeric ride_id returned by book")
|
|
3995
|
+
);
|
|
3996
|
+
attachSchemaHelp(set, rideCallbackSetSchema);
|
|
3997
|
+
set.action(
|
|
3998
|
+
() => postSubscription(deps, set, (o) => ridePath(o, ""), "ride-elife callback-set", "Ride callback registered")
|
|
3999
|
+
);
|
|
4000
|
+
const get = parent.command("callback-get").description("Show one ride's callback registration (the signing secret is never returned)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-id <id>", "The numeric ride_id returned by book");
|
|
4001
|
+
attachSchemaHelp(get, rideCallbackGetSchema);
|
|
4002
|
+
get.action(() => getJson(deps, get, (o) => ridePath(o, ""), formatSubscription));
|
|
4003
|
+
const defSet = withSubscriptionFlags(
|
|
4004
|
+
parent.command("callback-default-set").description("Register (or update) the developer-wide fallback for rides without their own callback").option("--api-key <key>", "API Key for authentication (X-Api-Key)")
|
|
4005
|
+
);
|
|
4006
|
+
attachSchemaHelp(defSet, rideCallbackDefaultSetSchema);
|
|
4007
|
+
defSet.action(
|
|
4008
|
+
() => postSubscription(
|
|
4009
|
+
deps,
|
|
4010
|
+
defSet,
|
|
4011
|
+
() => "/ride/callback/default",
|
|
4012
|
+
"ride-elife callback-default-set",
|
|
4013
|
+
"Default ride callback registered"
|
|
4014
|
+
)
|
|
4015
|
+
);
|
|
4016
|
+
const defGet = parent.command("callback-default-get").description("Show the developer-wide fallback callback (the signing secret is never returned)").option("--api-key <key>", "API Key for authentication (X-Api-Key)");
|
|
4017
|
+
attachSchemaHelp(defGet, rideCallbackDefaultGetSchema);
|
|
4018
|
+
defGet.action(() => getJson(deps, defGet, () => "/ride/callback/default", formatSubscription));
|
|
4019
|
+
const deliveries = parent.command("callback-deliveries").description("List one ride's callback forwarding records (pending / delivered / dead)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-id <id>", "The numeric ride_id returned by book").option("--limit <n>", `Page size 1-${DELIVERIES_LIMIT_MAX} (default 50)`).option("--offset <n>", "Records to skip (default 0)");
|
|
4020
|
+
attachSchemaHelp(deliveries, rideCallbackDeliveriesSchema);
|
|
4021
|
+
deliveries.action(
|
|
4022
|
+
() => getJson(
|
|
4023
|
+
deps,
|
|
4024
|
+
deliveries,
|
|
4025
|
+
(o) => ridePath(o, "/deliveries"),
|
|
4026
|
+
(data) => {
|
|
4027
|
+
const rows = data.deliveries ?? [];
|
|
4028
|
+
if (rows.length === 0) return Formatter.status("info", "No callback deliveries");
|
|
4029
|
+
return Formatter.table(
|
|
4030
|
+
["Event", "Status", "Attempts", "Last error"],
|
|
4031
|
+
rows.map((r) => [
|
|
4032
|
+
String(r.event_id ?? "-"),
|
|
4033
|
+
String(r.status ?? "-"),
|
|
4034
|
+
String(r.attempts ?? "-"),
|
|
4035
|
+
String(r.last_error ?? "-")
|
|
4036
|
+
])
|
|
4037
|
+
);
|
|
4038
|
+
},
|
|
4039
|
+
(o) => {
|
|
4040
|
+
const limit = intFlag(o.limit, "limit", 1, DELIVERIES_LIMIT_MAX);
|
|
4041
|
+
const offset = intFlag(o.offset, "offset", 0);
|
|
4042
|
+
const params = {};
|
|
4043
|
+
if (limit !== void 0) params.limit = String(limit);
|
|
4044
|
+
if (offset !== void 0) params.offset = String(offset);
|
|
4045
|
+
return Object.keys(params).length > 0 ? params : void 0;
|
|
4046
|
+
}
|
|
4047
|
+
)
|
|
4048
|
+
);
|
|
4049
|
+
const replay = parent.command("callback-replay").description("Requeue one ride's dead (or failed) callback records; delivered records are never re-sent").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-id <id>", "The numeric ride_id returned by book").option("--event-id <id>", "Requeue only this record (default: all dead records of the ride)").option("--include-failed", "Also requeue pending records that already failed at least once").option("--reset-attempts", "Reset the retry counter of requeued records").option("--idempotency-key <key>", "Idempotency key forwarded verbatim as the Idempotency-Key header");
|
|
4050
|
+
attachSchemaHelp(replay, rideCallbackReplaySchema);
|
|
4051
|
+
replay.action(async () => {
|
|
4052
|
+
const opts = replay.optsWithGlobals();
|
|
4053
|
+
const format = resolveFormat(opts.format);
|
|
4054
|
+
const target = ridePath(opts, "/replay");
|
|
4055
|
+
const body = {};
|
|
4056
|
+
if (opts.eventId !== void 0) body.event_id = need9(opts.eventId, "event-id");
|
|
4057
|
+
if (opts.includeFailed) body.include_failed = true;
|
|
4058
|
+
if (opts.resetAttempts) body.reset_attempts = true;
|
|
4059
|
+
const apiKey = await apiKeyOf(opts);
|
|
4060
|
+
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
4061
|
+
yes: Boolean(opts.yes),
|
|
4062
|
+
commandPath: "ride-elife callback-replay"
|
|
4063
|
+
});
|
|
4064
|
+
const result = await deps.apiClient.post(
|
|
4065
|
+
target,
|
|
4066
|
+
{ type: "api-key", key: apiKey },
|
|
4067
|
+
body,
|
|
4068
|
+
{ "Idempotency-Key": idempotencyKey }
|
|
4069
|
+
);
|
|
4070
|
+
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
4071
|
+
notify(format, "success", `Requeued ${String(result.data.requeued ?? 0)} callback record(s)`);
|
|
4072
|
+
await render2(
|
|
4073
|
+
result.data,
|
|
4074
|
+
() => Formatter.keyValue([
|
|
4075
|
+
["Ride ID", String(result.data.ride_id ?? "-")],
|
|
4076
|
+
["Requeued", String(result.data.requeued ?? 0)]
|
|
4077
|
+
]),
|
|
4078
|
+
format
|
|
4079
|
+
);
|
|
4080
|
+
});
|
|
4081
|
+
}
|
|
4082
|
+
|
|
3747
4083
|
// src/services/registry.ts
|
|
3748
4084
|
var SERVICE_REGISTRY = [
|
|
3749
4085
|
{
|
|
@@ -4308,7 +4644,7 @@ function registerOrdersPayBatchCommand(parent, deps) {
|
|
|
4308
4644
|
message: "API Key:",
|
|
4309
4645
|
type: "password"
|
|
4310
4646
|
});
|
|
4311
|
-
const orderIds = parseOrderIds(
|
|
4647
|
+
const orderIds = parseOrderIds(need10(opts.orderIds, "order-ids"));
|
|
4312
4648
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
4313
4649
|
yes: isYes,
|
|
4314
4650
|
commandPath: "orders pay-batch"
|
|
@@ -4378,22 +4714,59 @@ function registerOrdersPayBatchCommand(parent, deps) {
|
|
|
4378
4714
|
}
|
|
4379
4715
|
});
|
|
4380
4716
|
}
|
|
4381
|
-
function
|
|
4717
|
+
function need10(value, flag) {
|
|
4382
4718
|
if (value === void 0) {
|
|
4383
4719
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4384
4720
|
}
|
|
4385
4721
|
return value;
|
|
4386
4722
|
}
|
|
4387
4723
|
|
|
4724
|
+
// src/orders/get-payment-group.ts
|
|
4725
|
+
var PAYMENT_GROUP_ID_MAX = 64;
|
|
4726
|
+
function registerOrdersGetPaymentGroupCommand(parent, deps) {
|
|
4727
|
+
const cmd = parent.command("get-payment-group").description("Get the status of an aggregate settlement created by `orders pay-batch` (read-only)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").requiredOption("--payment-group-id <id>", "payment_group_id returned by `orders pay-batch`");
|
|
4728
|
+
attachSchemaHelp(cmd, ordersGetPaymentGroupSchema);
|
|
4729
|
+
cmd.action(async () => {
|
|
4730
|
+
const opts = cmd.optsWithGlobals();
|
|
4731
|
+
const format = resolveFormat(opts.format);
|
|
4732
|
+
const groupId = String(opts.paymentGroupId ?? "").trim();
|
|
4733
|
+
if (!groupId || groupId.length > PAYMENT_GROUP_ID_MAX) {
|
|
4734
|
+
throw new CliError(
|
|
4735
|
+
"PARAM_INVALID",
|
|
4736
|
+
`--payment-group-id must be 1-${PAYMENT_GROUP_ID_MAX} characters.`
|
|
4737
|
+
);
|
|
4738
|
+
}
|
|
4739
|
+
const apiKey = await PromptEngine.resolveInput(opts.apiKey, {
|
|
4740
|
+
message: "API Key:",
|
|
4741
|
+
type: "password"
|
|
4742
|
+
});
|
|
4743
|
+
const spinner = format === "json" ? null : createSpinner("Fetching payment group...");
|
|
4744
|
+
const result = await deps.apiClient.get(
|
|
4745
|
+
`/orders/payment-groups/${encodeURIComponent(groupId)}`,
|
|
4746
|
+
{ type: "api-key", key: apiKey }
|
|
4747
|
+
);
|
|
4748
|
+
spinner?.stop();
|
|
4749
|
+
if (!result.success) {
|
|
4750
|
+
throw CliError.fromApi(result, { auth: "api-key" });
|
|
4751
|
+
}
|
|
4752
|
+
const data = result.data;
|
|
4753
|
+
const commandResult = {
|
|
4754
|
+
data,
|
|
4755
|
+
text: () => formatPayBatch(data)
|
|
4756
|
+
};
|
|
4757
|
+
await renderWithContext(commandResult, { format }, new ConfigManager());
|
|
4758
|
+
});
|
|
4759
|
+
}
|
|
4760
|
+
|
|
4388
4761
|
// src/hotel-redaug/search.ts
|
|
4389
|
-
function
|
|
4762
|
+
function need11(value, flag) {
|
|
4390
4763
|
if (value === void 0) {
|
|
4391
4764
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4392
4765
|
}
|
|
4393
4766
|
return value;
|
|
4394
4767
|
}
|
|
4395
4768
|
function num5(value, flag) {
|
|
4396
|
-
const n = Number(
|
|
4769
|
+
const n = Number(need11(value, flag));
|
|
4397
4770
|
if (!Number.isFinite(n)) {
|
|
4398
4771
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4399
4772
|
}
|
|
@@ -4415,7 +4788,7 @@ function positiveInt3(value, flag) {
|
|
|
4415
4788
|
}
|
|
4416
4789
|
var YMD_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
4417
4790
|
function stayDate(value, flag) {
|
|
4418
|
-
const raw =
|
|
4791
|
+
const raw = need11(value, flag);
|
|
4419
4792
|
if (!YMD_RE.test(raw)) {
|
|
4420
4793
|
throw new CliError("PARAM_INVALID", `--${flag} must be a YYYY-MM-DD date.`);
|
|
4421
4794
|
}
|
|
@@ -4487,7 +4860,7 @@ function registerHotelSearchCommand(parent, deps) {
|
|
|
4487
4860
|
const pageSize = positiveInt3(opts.pageSize, "page-size");
|
|
4488
4861
|
const body = {};
|
|
4489
4862
|
if (hasDestination) {
|
|
4490
|
-
body.destination_id =
|
|
4863
|
+
body.destination_id = need11(opts.destinationId, "destination-id");
|
|
4491
4864
|
} else {
|
|
4492
4865
|
body.lat = coord(opts.lat, "lat", -90, 90);
|
|
4493
4866
|
body.lng = coord(opts.lng, "lng", -180, 180);
|
|
@@ -4530,14 +4903,14 @@ function registerHotelSearchCommand(parent, deps) {
|
|
|
4530
4903
|
}
|
|
4531
4904
|
|
|
4532
4905
|
// src/hotel-redaug/quote.ts
|
|
4533
|
-
function
|
|
4906
|
+
function need12(value, flag) {
|
|
4534
4907
|
if (value === void 0) {
|
|
4535
4908
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4536
4909
|
}
|
|
4537
4910
|
return value;
|
|
4538
4911
|
}
|
|
4539
4912
|
function num6(value, flag) {
|
|
4540
|
-
const n = Number(
|
|
4913
|
+
const n = Number(need12(value, flag));
|
|
4541
4914
|
if (!Number.isFinite(n)) {
|
|
4542
4915
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4543
4916
|
}
|
|
@@ -4545,7 +4918,7 @@ function num6(value, flag) {
|
|
|
4545
4918
|
}
|
|
4546
4919
|
var YMD_RE2 = /^\d{4}-\d{2}-\d{2}$/;
|
|
4547
4920
|
function stayDate2(value, flag) {
|
|
4548
|
-
const raw =
|
|
4921
|
+
const raw = need12(value, flag);
|
|
4549
4922
|
if (!YMD_RE2.test(raw)) {
|
|
4550
4923
|
throw new CliError("PARAM_INVALID", `--${flag} must be a YYYY-MM-DD date.`);
|
|
4551
4924
|
}
|
|
@@ -4585,7 +4958,7 @@ function registerHotelQuoteCommand(parent, deps) {
|
|
|
4585
4958
|
message: "API Key:",
|
|
4586
4959
|
type: "password"
|
|
4587
4960
|
});
|
|
4588
|
-
const hotelId =
|
|
4961
|
+
const hotelId = need12(opts.hotelId, "hotel-id");
|
|
4589
4962
|
const checkIn = stayDate2(opts.checkIn, "check-in");
|
|
4590
4963
|
const checkOut = stayDate2(opts.checkOut, "check-out");
|
|
4591
4964
|
if (!(checkOut > checkIn)) {
|
|
@@ -4705,14 +5078,14 @@ function parseCancellation(raw) {
|
|
|
4705
5078
|
}
|
|
4706
5079
|
return parsed;
|
|
4707
5080
|
}
|
|
4708
|
-
function
|
|
5081
|
+
function need13(value, flag) {
|
|
4709
5082
|
if (value === void 0) {
|
|
4710
5083
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4711
5084
|
}
|
|
4712
5085
|
return value;
|
|
4713
5086
|
}
|
|
4714
5087
|
function num7(value, flag) {
|
|
4715
|
-
const n = Number(
|
|
5088
|
+
const n = Number(need13(value, flag));
|
|
4716
5089
|
if (!Number.isFinite(n)) {
|
|
4717
5090
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4718
5091
|
}
|
|
@@ -4720,7 +5093,7 @@ function num7(value, flag) {
|
|
|
4720
5093
|
}
|
|
4721
5094
|
var YMD_RE3 = /^\d{4}-\d{2}-\d{2}$/;
|
|
4722
5095
|
function stayDate3(value, flag) {
|
|
4723
|
-
const raw =
|
|
5096
|
+
const raw = need13(value, flag);
|
|
4724
5097
|
if (!YMD_RE3.test(raw)) {
|
|
4725
5098
|
throw new CliError("PARAM_INVALID", `--${flag} must be a YYYY-MM-DD date.`);
|
|
4726
5099
|
}
|
|
@@ -4792,18 +5165,18 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
4792
5165
|
message: "API Key:",
|
|
4793
5166
|
type: "password"
|
|
4794
5167
|
});
|
|
4795
|
-
const productToken =
|
|
5168
|
+
const productToken = need13(opts.productToken, "product-token");
|
|
4796
5169
|
const totalAmount = num7(opts.totalAmount, "total-amount");
|
|
4797
|
-
const currency =
|
|
4798
|
-
const priceItems = parsePriceItems(
|
|
5170
|
+
const currency = need13(opts.currency, "currency");
|
|
5171
|
+
const priceItems = parsePriceItems(need13(opts.priceItems, "price-items"));
|
|
4799
5172
|
const checkIn = stayDate3(opts.checkIn, "check-in");
|
|
4800
5173
|
const checkOut = stayDate3(opts.checkOut, "check-out");
|
|
4801
5174
|
if (!(checkOut > checkIn)) {
|
|
4802
5175
|
throw new CliError("PARAM_INVALID", "--check-out must be strictly after --check-in.");
|
|
4803
5176
|
}
|
|
4804
|
-
const guestName =
|
|
4805
|
-
const contactName =
|
|
4806
|
-
const contactPhone =
|
|
5177
|
+
const guestName = need13(opts.guestName, "guest-name");
|
|
5178
|
+
const contactName = need13(opts.contactName, "contact-name");
|
|
5179
|
+
const contactPhone = need13(opts.contactPhone, "contact-phone");
|
|
4807
5180
|
const body = {
|
|
4808
5181
|
product_token: productToken,
|
|
4809
5182
|
total_amount: totalAmount,
|
|
@@ -5155,7 +5528,7 @@ function registerHotelPayOrderCommand(parent, deps) {
|
|
|
5155
5528
|
}
|
|
5156
5529
|
|
|
5157
5530
|
// src/hotel-redaug/get.ts
|
|
5158
|
-
function
|
|
5531
|
+
function need14(value, flag) {
|
|
5159
5532
|
if (value === void 0) {
|
|
5160
5533
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
5161
5534
|
}
|
|
@@ -5219,7 +5592,7 @@ function registerHotelGetCommand(parent, deps) {
|
|
|
5219
5592
|
message: "API Key:",
|
|
5220
5593
|
type: "password"
|
|
5221
5594
|
});
|
|
5222
|
-
const orderId =
|
|
5595
|
+
const orderId = need14(opts.orderId, "order-id");
|
|
5223
5596
|
if (opts.watch) {
|
|
5224
5597
|
await watchOrderStatus(deps.apiClient, apiKey, orderId, {
|
|
5225
5598
|
intervalSeconds: resolveSeconds(
|
|
@@ -5253,7 +5626,7 @@ function registerHotelGetCommand(parent, deps) {
|
|
|
5253
5626
|
}
|
|
5254
5627
|
|
|
5255
5628
|
// src/hotel-redaug/cancel.ts
|
|
5256
|
-
function
|
|
5629
|
+
function need15(value, flag) {
|
|
5257
5630
|
if (value === void 0) {
|
|
5258
5631
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
5259
5632
|
}
|
|
@@ -5306,8 +5679,8 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
5306
5679
|
message: "API Key:",
|
|
5307
5680
|
type: "password"
|
|
5308
5681
|
});
|
|
5309
|
-
const orderId =
|
|
5310
|
-
const fcOrderCode =
|
|
5682
|
+
const orderId = need15(opts.orderId, "order-id");
|
|
5683
|
+
const fcOrderCode = need15(opts.fcOrderCode, "fc-order-code");
|
|
5311
5684
|
const body = { fc_order_code: fcOrderCode };
|
|
5312
5685
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
5313
5686
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5337,14 +5710,14 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
5337
5710
|
|
|
5338
5711
|
// src/hotel-redaug/checkout.ts
|
|
5339
5712
|
import { confirm as confirm9 } from "@inquirer/prompts";
|
|
5340
|
-
function
|
|
5713
|
+
function need16(value, flag) {
|
|
5341
5714
|
if (value === void 0) {
|
|
5342
5715
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
5343
5716
|
}
|
|
5344
5717
|
return value;
|
|
5345
5718
|
}
|
|
5346
5719
|
function num8(value, flag) {
|
|
5347
|
-
const n = Number(
|
|
5720
|
+
const n = Number(need16(value, flag));
|
|
5348
5721
|
if (!Number.isFinite(n)) {
|
|
5349
5722
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
5350
5723
|
}
|
|
@@ -5410,10 +5783,10 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
5410
5783
|
message: "API Key:",
|
|
5411
5784
|
type: "password"
|
|
5412
5785
|
});
|
|
5413
|
-
const orderId =
|
|
5414
|
-
const fcOrderCode =
|
|
5415
|
-
const reason =
|
|
5416
|
-
const checkoutRooms = parseCheckoutRooms(
|
|
5786
|
+
const orderId = need16(opts.orderId, "order-id");
|
|
5787
|
+
const fcOrderCode = need16(opts.fcOrderCode, "fc-order-code");
|
|
5788
|
+
const reason = need16(opts.reason, "reason");
|
|
5789
|
+
const checkoutRooms = parseCheckoutRooms(need16(opts.checkoutRooms, "checkout-rooms"));
|
|
5417
5790
|
const refundType = num8(opts.refundType, "refund-type");
|
|
5418
5791
|
const body = {
|
|
5419
5792
|
fc_order_code: fcOrderCode,
|
|
@@ -5456,7 +5829,7 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
5456
5829
|
}
|
|
5457
5830
|
|
|
5458
5831
|
// src/hotel-redaug/get-checkout.ts
|
|
5459
|
-
function
|
|
5832
|
+
function need17(value, flag) {
|
|
5460
5833
|
if (value === void 0) {
|
|
5461
5834
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
5462
5835
|
}
|
|
@@ -5492,7 +5865,7 @@ function registerHotelGetCheckoutCommand(parent, deps) {
|
|
|
5492
5865
|
message: "API Key:",
|
|
5493
5866
|
type: "password"
|
|
5494
5867
|
});
|
|
5495
|
-
const taskOrderCode =
|
|
5868
|
+
const taskOrderCode = need17(opts.taskOrderCode, "task-order-code");
|
|
5496
5869
|
if (opts.watch) {
|
|
5497
5870
|
await watchCheckoutStatus(deps.apiClient, apiKey, taskOrderCode, {
|
|
5498
5871
|
intervalSeconds: resolveSeconds(
|
|
@@ -5596,7 +5969,7 @@ function registerHotelListOrdersCommand(parent, deps) {
|
|
|
5596
5969
|
}
|
|
5597
5970
|
|
|
5598
5971
|
// src/hotel-redaug/find-destination.ts
|
|
5599
|
-
function
|
|
5972
|
+
function need18(value, flag) {
|
|
5600
5973
|
if (value === void 0 || value.trim() === "") {
|
|
5601
5974
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
5602
5975
|
}
|
|
@@ -5630,7 +6003,7 @@ function registerHotelFindDestinationCommand(parent, deps) {
|
|
|
5630
6003
|
message: "API Key:",
|
|
5631
6004
|
type: "password"
|
|
5632
6005
|
});
|
|
5633
|
-
const keyword =
|
|
6006
|
+
const keyword = need18(opts.keyword, "keyword");
|
|
5634
6007
|
const body = { keyword };
|
|
5635
6008
|
if (opts.dataType !== void 0) {
|
|
5636
6009
|
body.data_type = opts.dataType;
|
|
@@ -5654,14 +6027,14 @@ function registerHotelFindDestinationCommand(parent, deps) {
|
|
|
5654
6027
|
}
|
|
5655
6028
|
|
|
5656
6029
|
// src/hotel-redaug/hotel-filters.ts
|
|
5657
|
-
function
|
|
6030
|
+
function need19(value, flag) {
|
|
5658
6031
|
if (value === void 0 || value.trim() === "") {
|
|
5659
6032
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
5660
6033
|
}
|
|
5661
6034
|
return value;
|
|
5662
6035
|
}
|
|
5663
6036
|
function num9(value, flag) {
|
|
5664
|
-
const n = Number(
|
|
6037
|
+
const n = Number(need19(value, flag));
|
|
5665
6038
|
if (!Number.isFinite(n)) {
|
|
5666
6039
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
5667
6040
|
}
|
|
@@ -5741,7 +6114,7 @@ function registerHotelFiltersCommand(parent, deps) {
|
|
|
5741
6114
|
}
|
|
5742
6115
|
const body = {};
|
|
5743
6116
|
if (hasDestination) {
|
|
5744
|
-
body.destination_id =
|
|
6117
|
+
body.destination_id = need19(opts.destinationId, "destination-id");
|
|
5745
6118
|
} else {
|
|
5746
6119
|
body.lat = coord2(opts.lat, "lat", -90, 90);
|
|
5747
6120
|
body.lng = coord2(opts.lng, "lng", -180, 180);
|
|
@@ -5766,7 +6139,7 @@ function registerHotelFiltersCommand(parent, deps) {
|
|
|
5766
6139
|
}
|
|
5767
6140
|
|
|
5768
6141
|
// src/hotel-redaug/list-cities.ts
|
|
5769
|
-
function
|
|
6142
|
+
function need20(value, flag) {
|
|
5770
6143
|
if (value === void 0 || value.trim() === "") {
|
|
5771
6144
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
5772
6145
|
}
|
|
@@ -5799,7 +6172,7 @@ function registerHotelListCitiesCommand(parent, deps) {
|
|
|
5799
6172
|
message: "API Key:",
|
|
5800
6173
|
type: "password"
|
|
5801
6174
|
});
|
|
5802
|
-
const country =
|
|
6175
|
+
const country = need20(opts.country, "country");
|
|
5803
6176
|
const body = { country_code: country };
|
|
5804
6177
|
const result = await deps.apiClient.post(
|
|
5805
6178
|
"/hotel/cities",
|
|
@@ -5820,7 +6193,7 @@ function registerHotelListCitiesCommand(parent, deps) {
|
|
|
5820
6193
|
}
|
|
5821
6194
|
|
|
5822
6195
|
// src/hotel-redaug/hotel-detail.ts
|
|
5823
|
-
function
|
|
6196
|
+
function need21(value, flag) {
|
|
5824
6197
|
if (value === void 0 || value.trim() === "") {
|
|
5825
6198
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
5826
6199
|
}
|
|
@@ -5967,7 +6340,7 @@ function registerHotelDetailCommand(parent, deps) {
|
|
|
5967
6340
|
message: "API Key:",
|
|
5968
6341
|
type: "password"
|
|
5969
6342
|
});
|
|
5970
|
-
const hotelId =
|
|
6343
|
+
const hotelId = need21(opts.hotelId, "hotel-id");
|
|
5971
6344
|
const rawWithImages = opts.withImages;
|
|
5972
6345
|
const withImages = rawWithImages !== "false" && rawWithImages !== false;
|
|
5973
6346
|
const settings = parseSettings(opts.settings);
|
|
@@ -6175,14 +6548,14 @@ function registerHotelSkillCommand(parent) {
|
|
|
6175
6548
|
}
|
|
6176
6549
|
|
|
6177
6550
|
// src/flight-flink/_helpers.ts
|
|
6178
|
-
function
|
|
6551
|
+
function need22(value, flag) {
|
|
6179
6552
|
if (value === void 0) {
|
|
6180
6553
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
6181
6554
|
}
|
|
6182
6555
|
return value;
|
|
6183
6556
|
}
|
|
6184
6557
|
function num10(value, flag) {
|
|
6185
|
-
const n = Number(
|
|
6558
|
+
const n = Number(need22(value, flag));
|
|
6186
6559
|
if (!Number.isFinite(n)) {
|
|
6187
6560
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
6188
6561
|
}
|
|
@@ -6203,7 +6576,7 @@ function jsonArray(raw, flag) {
|
|
|
6203
6576
|
function resolveApiKey(flag) {
|
|
6204
6577
|
return PromptEngine.resolveInput(flag, { message: "API Key:", type: "password" });
|
|
6205
6578
|
}
|
|
6206
|
-
async function
|
|
6579
|
+
async function render3(data, format, text) {
|
|
6207
6580
|
const resolved = resolveFormat(format);
|
|
6208
6581
|
const result = { data, text: () => text(data) };
|
|
6209
6582
|
await renderWithContext(result, { format: resolved }, new ConfigManager());
|
|
@@ -6217,7 +6590,7 @@ function registerFindAirportCommand(parent, deps) {
|
|
|
6217
6590
|
const opts = cmd.optsWithGlobals();
|
|
6218
6591
|
const format = resolveFormat(opts.format);
|
|
6219
6592
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6220
|
-
const keyword =
|
|
6593
|
+
const keyword = need22(opts.keyword, "keyword");
|
|
6221
6594
|
const spinner = format === "json" ? null : createSpinner("Resolving airports...");
|
|
6222
6595
|
const result = await deps.apiClient.post(
|
|
6223
6596
|
"/flight/find-airport",
|
|
@@ -6226,7 +6599,7 @@ function registerFindAirportCommand(parent, deps) {
|
|
|
6226
6599
|
);
|
|
6227
6600
|
spinner?.stop();
|
|
6228
6601
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6229
|
-
await
|
|
6602
|
+
await render3(
|
|
6230
6603
|
result.data,
|
|
6231
6604
|
opts.format,
|
|
6232
6605
|
(d) => JSON.stringify(d.airports ?? d, null, 2)
|
|
@@ -6255,7 +6628,7 @@ function registerListAirportsCommand(parent, deps) {
|
|
|
6255
6628
|
);
|
|
6256
6629
|
spinner?.stop();
|
|
6257
6630
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6258
|
-
await
|
|
6631
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6259
6632
|
});
|
|
6260
6633
|
}
|
|
6261
6634
|
|
|
@@ -6280,7 +6653,7 @@ function registerListAirlinesCommand(parent, deps) {
|
|
|
6280
6653
|
);
|
|
6281
6654
|
spinner?.stop();
|
|
6282
6655
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6283
|
-
await
|
|
6656
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6284
6657
|
});
|
|
6285
6658
|
}
|
|
6286
6659
|
|
|
@@ -6300,7 +6673,7 @@ function registerListNationalitiesCommand(parent, deps) {
|
|
|
6300
6673
|
);
|
|
6301
6674
|
spinner?.stop();
|
|
6302
6675
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6303
|
-
await
|
|
6676
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6304
6677
|
});
|
|
6305
6678
|
}
|
|
6306
6679
|
|
|
@@ -6314,7 +6687,7 @@ function registerSearchCommand(parent, deps) {
|
|
|
6314
6687
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6315
6688
|
const body = {
|
|
6316
6689
|
trip_type: num10(opts.tripType, "trip-type"),
|
|
6317
|
-
journeys: jsonArray(
|
|
6690
|
+
journeys: jsonArray(need22(opts.journeys, "journeys"), "journeys"),
|
|
6318
6691
|
cabin_class: opts.cabinClass,
|
|
6319
6692
|
adult_num: num10(opts.adultNum, "adult-num"),
|
|
6320
6693
|
child_num: num10(opts.childNum, "child-num"),
|
|
@@ -6333,7 +6706,7 @@ function registerSearchCommand(parent, deps) {
|
|
|
6333
6706
|
);
|
|
6334
6707
|
spinner?.stop();
|
|
6335
6708
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6336
|
-
await
|
|
6709
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6337
6710
|
});
|
|
6338
6711
|
}
|
|
6339
6712
|
|
|
@@ -6345,7 +6718,7 @@ function registerMoreOffersCommand(parent, deps) {
|
|
|
6345
6718
|
const opts = cmd.optsWithGlobals();
|
|
6346
6719
|
const format = resolveFormat(opts.format);
|
|
6347
6720
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6348
|
-
const productToken =
|
|
6721
|
+
const productToken = need22(opts.productToken, "product-token");
|
|
6349
6722
|
const spinner = format === "json" ? null : createSpinner("Fetching offers...");
|
|
6350
6723
|
const result = await deps.apiClient.post(
|
|
6351
6724
|
"/flight/more-offers",
|
|
@@ -6354,7 +6727,7 @@ function registerMoreOffersCommand(parent, deps) {
|
|
|
6354
6727
|
);
|
|
6355
6728
|
spinner?.stop();
|
|
6356
6729
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6357
|
-
await
|
|
6730
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6358
6731
|
});
|
|
6359
6732
|
}
|
|
6360
6733
|
|
|
@@ -6366,7 +6739,7 @@ function registerVerifyCommand(parent, deps) {
|
|
|
6366
6739
|
const opts = cmd.optsWithGlobals();
|
|
6367
6740
|
const format = resolveFormat(opts.format);
|
|
6368
6741
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6369
|
-
const productToken =
|
|
6742
|
+
const productToken = need22(opts.productToken, "product-token");
|
|
6370
6743
|
const body = { product_token: productToken };
|
|
6371
6744
|
if (opts.previousTotalPrice !== void 0) {
|
|
6372
6745
|
body.previous_total_price = num10(opts.previousTotalPrice, "previous-total-price");
|
|
@@ -6383,7 +6756,7 @@ function registerVerifyCommand(parent, deps) {
|
|
|
6383
6756
|
);
|
|
6384
6757
|
spinner?.stop();
|
|
6385
6758
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6386
|
-
await
|
|
6759
|
+
await render3(
|
|
6387
6760
|
result.data,
|
|
6388
6761
|
opts.format,
|
|
6389
6762
|
(d) => Formatter.keyValue([
|
|
@@ -6400,7 +6773,10 @@ function registerVerifyCommand(parent, deps) {
|
|
|
6400
6773
|
// src/flight-flink/create-order.ts
|
|
6401
6774
|
import { confirm as confirm10 } from "@inquirer/prompts";
|
|
6402
6775
|
function registerCreateOrderCommand(parent, deps) {
|
|
6403
|
-
const cmd = parent.command("create-order").description("Create a flight order without charging (locks the fare, await payment)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--product-token <token>", "Authoritative rate token from verify").option("--total-amount <amount>", "Verified total price in decimal units").option("--currency <currency>", "ISO 4217 currency code").option("--trip-type <n>", "1/2/3", "1").option("--contact-name <name>", "Booking contact name").option("--contact-region <code>", "Contact phone country code (no '+')").option("--contact-phone <phone>", "Booking contact phone").option("--contact-email <email>", "Booking contact email").option(
|
|
6776
|
+
const cmd = parent.command("create-order").description("Create a flight order without charging (locks the fare, await payment)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--product-token <token>", "Authoritative rate token from verify").option("--total-amount <amount>", "Verified total price in decimal units").option("--currency <currency>", "ISO 4217 currency code").option("--trip-type <n>", "1/2/3", "1").option("--contact-name <name>", "Booking contact name").option("--contact-region <code>", "Contact phone country code (no '+')").option("--contact-phone <phone>", "Booking contact phone").option("--contact-email <email>", "Booking contact email").option(
|
|
6777
|
+
"--passengers <json>",
|
|
6778
|
+
'JSON array of passengers (gender/id_type are strings). A passenger may be just {"traveller_token":"tvp_...","type":"adult"} from token-cli travellers list.'
|
|
6779
|
+
).option("--save-travellers", "Save the fully filled passengers as frequent travellers (only when the user asked)").option("--payment-method-id <id>", "Optional bound-card id (pay_per_call only)").option("--payment-token-id <id>", "Optional UPI network-token id (unionpay charge path)").option(
|
|
6404
6780
|
"--authorized-merchant-trans-id <id>",
|
|
6405
6781
|
"EVO merchant transaction id of an already-authorised preauth (3DS challenge resume). When set, the server reuses that authorization instead of creating a new one, avoiding a second hold on the card (pay_per_call mode only)."
|
|
6406
6782
|
).option("--member <id>", MEMBER_OPTION_DESCRIPTION).option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
@@ -6410,20 +6786,21 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
6410
6786
|
const format = resolveFormat(opts.format);
|
|
6411
6787
|
const isYes = Boolean(opts.yes);
|
|
6412
6788
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6413
|
-
const productToken =
|
|
6789
|
+
const productToken = need22(opts.productToken, "product-token");
|
|
6414
6790
|
const totalAmount = num10(opts.totalAmount, "total-amount");
|
|
6415
|
-
const currency =
|
|
6791
|
+
const currency = need22(opts.currency, "currency");
|
|
6416
6792
|
const body = {
|
|
6417
6793
|
product_token: productToken,
|
|
6418
6794
|
total_amount: totalAmount,
|
|
6419
6795
|
currency,
|
|
6420
6796
|
trip_type: num10(opts.tripType, "trip-type"),
|
|
6421
|
-
contact_name:
|
|
6422
|
-
contact_region:
|
|
6423
|
-
contact_phone:
|
|
6424
|
-
contact_email:
|
|
6425
|
-
passengers: jsonArray(
|
|
6797
|
+
contact_name: need22(opts.contactName, "contact-name"),
|
|
6798
|
+
contact_region: need22(opts.contactRegion, "contact-region"),
|
|
6799
|
+
contact_phone: need22(opts.contactPhone, "contact-phone"),
|
|
6800
|
+
contact_email: need22(opts.contactEmail, "contact-email"),
|
|
6801
|
+
passengers: jsonArray(need22(opts.passengers, "passengers"), "passengers")
|
|
6426
6802
|
};
|
|
6803
|
+
if (opts.saveTravellers) body.save_travellers = true;
|
|
6427
6804
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
6428
6805
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
6429
6806
|
if (opts.authorizedMerchantTransId) {
|
|
@@ -6451,7 +6828,7 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
6451
6828
|
);
|
|
6452
6829
|
spinner?.stop();
|
|
6453
6830
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6454
|
-
await
|
|
6831
|
+
await render3(
|
|
6455
6832
|
result.data,
|
|
6456
6833
|
opts.format,
|
|
6457
6834
|
(d) => [
|
|
@@ -6495,7 +6872,7 @@ function registerPayOrderCommand(parent, deps) {
|
|
|
6495
6872
|
const format = resolveFormat(opts.format);
|
|
6496
6873
|
const isYes = Boolean(opts.yes);
|
|
6497
6874
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6498
|
-
const orderNo =
|
|
6875
|
+
const orderNo = need22(opts.orderNo, "order-no");
|
|
6499
6876
|
if (!isYes) {
|
|
6500
6877
|
const ok = await confirm11({
|
|
6501
6878
|
message: `Pay and ticket order ${orderNo}? This settles the order and issues tickets.`,
|
|
@@ -6528,7 +6905,7 @@ function registerPayOrderCommand(parent, deps) {
|
|
|
6528
6905
|
);
|
|
6529
6906
|
spinner?.stop();
|
|
6530
6907
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6531
|
-
await
|
|
6908
|
+
await render3(result.data, opts.format, (d) => {
|
|
6532
6909
|
const rows = [
|
|
6533
6910
|
["Order no", String(d.order_no ?? "-")],
|
|
6534
6911
|
["Status", String(d.status ?? "-")],
|
|
@@ -6553,7 +6930,7 @@ function registerGetOrderCommand(parent, deps) {
|
|
|
6553
6930
|
const opts = cmd.optsWithGlobals();
|
|
6554
6931
|
const format = resolveFormat(opts.format);
|
|
6555
6932
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6556
|
-
const orderNo =
|
|
6933
|
+
const orderNo = need22(opts.orderNo, "order-no");
|
|
6557
6934
|
const path = `/flight/${encodeURIComponent(orderNo)}/status`;
|
|
6558
6935
|
const auth = { type: "api-key", key: apiKey };
|
|
6559
6936
|
if (opts.watch) {
|
|
@@ -6578,7 +6955,7 @@ function registerGetOrderCommand(parent, deps) {
|
|
|
6578
6955
|
const result = await deps.apiClient.get(path, auth);
|
|
6579
6956
|
spinner?.stop();
|
|
6580
6957
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6581
|
-
await
|
|
6958
|
+
await render3(
|
|
6582
6959
|
result.data,
|
|
6583
6960
|
opts.format,
|
|
6584
6961
|
(d) => Formatter.keyValue([
|
|
@@ -6602,7 +6979,7 @@ function registerCancelOrderCommand(parent, deps) {
|
|
|
6602
6979
|
const format = resolveFormat(opts.format);
|
|
6603
6980
|
const isYes = Boolean(opts.yes);
|
|
6604
6981
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6605
|
-
const orderNo =
|
|
6982
|
+
const orderNo = need22(opts.orderNo, "order-no");
|
|
6606
6983
|
if (!isYes) {
|
|
6607
6984
|
const ok = await confirm12({
|
|
6608
6985
|
message: `Cancel order ${orderNo}? This requests cancellation and a refund.`,
|
|
@@ -6625,7 +7002,7 @@ function registerCancelOrderCommand(parent, deps) {
|
|
|
6625
7002
|
);
|
|
6626
7003
|
spinner?.stop();
|
|
6627
7004
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6628
|
-
await
|
|
7005
|
+
await render3(
|
|
6629
7006
|
result.data,
|
|
6630
7007
|
opts.format,
|
|
6631
7008
|
(d) => Formatter.keyValue([
|
|
@@ -6658,7 +7035,7 @@ function registerListOrdersCommand2(parent, deps) {
|
|
|
6658
7035
|
);
|
|
6659
7036
|
spinner?.stop();
|
|
6660
7037
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6661
|
-
await
|
|
7038
|
+
await render3(result.data, opts.format, (d) => {
|
|
6662
7039
|
const rows = (d.orders ?? []).map((o) => [
|
|
6663
7040
|
String(o.order_no ?? "-"),
|
|
6664
7041
|
String(o.status ?? "-"),
|
|
@@ -6678,10 +7055,10 @@ function registerChangeSearchCommand(parent, deps) {
|
|
|
6678
7055
|
const format = resolveFormat(opts.format);
|
|
6679
7056
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6680
7057
|
const body = {
|
|
6681
|
-
order_no:
|
|
6682
|
-
date:
|
|
6683
|
-
passenger:
|
|
6684
|
-
segment_id:
|
|
7058
|
+
order_no: need22(opts.orderNo, "order-no"),
|
|
7059
|
+
date: need22(opts.date, "date"),
|
|
7060
|
+
passenger: need22(opts.passenger, "passenger"),
|
|
7061
|
+
segment_id: need22(opts.segmentId, "segment-id"),
|
|
6685
7062
|
cabin_class: opts.cabinClass
|
|
6686
7063
|
};
|
|
6687
7064
|
const spinner = format === "json" ? null : createSpinner("Searching change options...");
|
|
@@ -6692,7 +7069,7 @@ function registerChangeSearchCommand(parent, deps) {
|
|
|
6692
7069
|
);
|
|
6693
7070
|
spinner?.stop();
|
|
6694
7071
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6695
|
-
await
|
|
7072
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6696
7073
|
});
|
|
6697
7074
|
}
|
|
6698
7075
|
|
|
@@ -6707,14 +7084,14 @@ function registerChangeApplyCommand(parent, deps) {
|
|
|
6707
7084
|
const isYes = Boolean(opts.yes);
|
|
6708
7085
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6709
7086
|
const body = {
|
|
6710
|
-
order_no:
|
|
6711
|
-
passenger:
|
|
6712
|
-
segment_id:
|
|
6713
|
-
product_token:
|
|
6714
|
-
contact_name:
|
|
6715
|
-
contact_region:
|
|
6716
|
-
contact_phone:
|
|
6717
|
-
contact_email:
|
|
7087
|
+
order_no: need22(opts.orderNo, "order-no"),
|
|
7088
|
+
passenger: need22(opts.passenger, "passenger"),
|
|
7089
|
+
segment_id: need22(opts.segmentId, "segment-id"),
|
|
7090
|
+
product_token: need22(opts.productToken, "product-token"),
|
|
7091
|
+
contact_name: need22(opts.contactName, "contact-name"),
|
|
7092
|
+
contact_region: need22(opts.contactRegion, "contact-region"),
|
|
7093
|
+
contact_phone: need22(opts.contactPhone, "contact-phone"),
|
|
7094
|
+
contact_email: need22(opts.contactEmail, "contact-email")
|
|
6718
7095
|
};
|
|
6719
7096
|
if (!isYes) {
|
|
6720
7097
|
const ok = await confirm13({
|
|
@@ -6736,7 +7113,7 @@ function registerChangeApplyCommand(parent, deps) {
|
|
|
6736
7113
|
);
|
|
6737
7114
|
spinner?.stop();
|
|
6738
7115
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6739
|
-
await
|
|
7116
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6740
7117
|
});
|
|
6741
7118
|
}
|
|
6742
7119
|
|
|
@@ -6748,7 +7125,7 @@ function registerChangeDetailCommand(parent, deps) {
|
|
|
6748
7125
|
const opts = cmd.optsWithGlobals();
|
|
6749
7126
|
const format = resolveFormat(opts.format);
|
|
6750
7127
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6751
|
-
const changeOrderNo =
|
|
7128
|
+
const changeOrderNo = need22(opts.changeOrderNo, "change-order-no");
|
|
6752
7129
|
const spinner = format === "json" ? null : createSpinner("Fetching change detail...");
|
|
6753
7130
|
const result = await deps.apiClient.get(
|
|
6754
7131
|
`/flight/change/${encodeURIComponent(changeOrderNo)}`,
|
|
@@ -6756,7 +7133,7 @@ function registerChangeDetailCommand(parent, deps) {
|
|
|
6756
7133
|
);
|
|
6757
7134
|
spinner?.stop();
|
|
6758
7135
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6759
|
-
await
|
|
7136
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6760
7137
|
});
|
|
6761
7138
|
}
|
|
6762
7139
|
|
|
@@ -6770,7 +7147,7 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
6770
7147
|
const format = resolveFormat(opts.format);
|
|
6771
7148
|
const isYes = Boolean(opts.yes);
|
|
6772
7149
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6773
|
-
const changeOrderNo =
|
|
7150
|
+
const changeOrderNo = need22(opts.changeOrderNo, "change-order-no");
|
|
6774
7151
|
if (!isYes) {
|
|
6775
7152
|
const ok = await confirm14({ message: `Cancel change request ${changeOrderNo}?`, default: false });
|
|
6776
7153
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Change cancellation aborted by user.");
|
|
@@ -6788,7 +7165,7 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
6788
7165
|
);
|
|
6789
7166
|
spinner?.stop();
|
|
6790
7167
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6791
|
-
await
|
|
7168
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6792
7169
|
});
|
|
6793
7170
|
}
|
|
6794
7171
|
|
|
@@ -6805,10 +7182,10 @@ function registerChangePayCommand(parent, deps) {
|
|
|
6805
7182
|
const format = resolveFormat(opts.format);
|
|
6806
7183
|
const isYes = Boolean(opts.yes);
|
|
6807
7184
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6808
|
-
const changeOrderNo =
|
|
6809
|
-
const orderNo =
|
|
7185
|
+
const changeOrderNo = need22(opts.changeOrderNo, "change-order-no");
|
|
7186
|
+
const orderNo = need22(opts.orderNo, "order-no");
|
|
6810
7187
|
const amount = num10(opts.amount, "amount");
|
|
6811
|
-
const currency =
|
|
7188
|
+
const currency = need22(opts.currency, "currency");
|
|
6812
7189
|
const body = {
|
|
6813
7190
|
order_no: orderNo,
|
|
6814
7191
|
amount,
|
|
@@ -6838,7 +7215,7 @@ function registerChangePayCommand(parent, deps) {
|
|
|
6838
7215
|
);
|
|
6839
7216
|
spinner?.stop();
|
|
6840
7217
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6841
|
-
await
|
|
7218
|
+
await render3(result.data, opts.format, (d) => {
|
|
6842
7219
|
const challenge = d.challenge ?? null;
|
|
6843
7220
|
if (challenge) {
|
|
6844
7221
|
return [
|
|
@@ -6879,14 +7256,14 @@ function registerRefundApplyCommand(parent, deps) {
|
|
|
6879
7256
|
const isYes = Boolean(opts.yes);
|
|
6880
7257
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6881
7258
|
const body = {
|
|
6882
|
-
order_no:
|
|
6883
|
-
passenger:
|
|
6884
|
-
segment_id:
|
|
7259
|
+
order_no: need22(opts.orderNo, "order-no"),
|
|
7260
|
+
passenger: need22(opts.passenger, "passenger"),
|
|
7261
|
+
segment_id: need22(opts.segmentId, "segment-id"),
|
|
6885
7262
|
reason_type: num10(opts.reasonType, "reason-type"),
|
|
6886
|
-
contact_name:
|
|
6887
|
-
contact_region:
|
|
6888
|
-
contact_phone:
|
|
6889
|
-
contact_email:
|
|
7263
|
+
contact_name: need22(opts.contactName, "contact-name"),
|
|
7264
|
+
contact_region: need22(opts.contactRegion, "contact-region"),
|
|
7265
|
+
contact_phone: need22(opts.contactPhone, "contact-phone"),
|
|
7266
|
+
contact_email: need22(opts.contactEmail, "contact-email")
|
|
6890
7267
|
};
|
|
6891
7268
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
6892
7269
|
if (!isYes) {
|
|
@@ -6909,7 +7286,7 @@ function registerRefundApplyCommand(parent, deps) {
|
|
|
6909
7286
|
);
|
|
6910
7287
|
spinner?.stop();
|
|
6911
7288
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6912
|
-
await
|
|
7289
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6913
7290
|
});
|
|
6914
7291
|
}
|
|
6915
7292
|
|
|
@@ -6921,7 +7298,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
6921
7298
|
const opts = cmd.optsWithGlobals();
|
|
6922
7299
|
const format = resolveFormat(opts.format);
|
|
6923
7300
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6924
|
-
const refundOrderNo =
|
|
7301
|
+
const refundOrderNo = need22(opts.refundOrderNo, "refund-order-no");
|
|
6925
7302
|
const spinner = format === "json" ? null : createSpinner("Fetching refund detail...");
|
|
6926
7303
|
const result = await deps.apiClient.get(
|
|
6927
7304
|
`/flight/refund/${encodeURIComponent(refundOrderNo)}`,
|
|
@@ -6929,7 +7306,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
6929
7306
|
);
|
|
6930
7307
|
spinner?.stop();
|
|
6931
7308
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6932
|
-
await
|
|
7309
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6933
7310
|
});
|
|
6934
7311
|
}
|
|
6935
7312
|
|
|
@@ -6943,8 +7320,8 @@ function registerRefundConfirmCommand(parent, deps) {
|
|
|
6943
7320
|
const format = resolveFormat(opts.format);
|
|
6944
7321
|
const isYes = Boolean(opts.yes);
|
|
6945
7322
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
6946
|
-
const refundOrderNo =
|
|
6947
|
-
const confirmFlag =
|
|
7323
|
+
const refundOrderNo = need22(opts.refundOrderNo, "refund-order-no");
|
|
7324
|
+
const confirmFlag = need22(opts.confirm, "confirm");
|
|
6948
7325
|
if (confirmFlag !== "1" && confirmFlag !== "2") {
|
|
6949
7326
|
throw new CliError("PARAM_INVALID", '--confirm must be "1" (confirm) or "2" (cancel).');
|
|
6950
7327
|
}
|
|
@@ -6966,7 +7343,7 @@ function registerRefundConfirmCommand(parent, deps) {
|
|
|
6966
7343
|
);
|
|
6967
7344
|
spinner?.stop();
|
|
6968
7345
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
6969
|
-
await
|
|
7346
|
+
await render3(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
|
|
6970
7347
|
});
|
|
6971
7348
|
}
|
|
6972
7349
|
|
|
@@ -7099,6 +7476,9 @@ Workflow (typical order):
|
|
|
7099
7476
|
(write; needs --idempotency-key; the fare may change)
|
|
7100
7477
|
trip-status (optional) Status + driver location points of ONE leg of a multi-leg ride
|
|
7101
7478
|
list-orders (standalone) List the developer's previous ride orders
|
|
7479
|
+
callback-* (standalone) Status-event forwarding to your own https endpoint:
|
|
7480
|
+
callback-set/-get (one ride), callback-default-set/-get (fallback for all
|
|
7481
|
+
rides), callback-deliveries / callback-replay (inspect and re-send)
|
|
7102
7482
|
|
|
7103
7483
|
Key notes:
|
|
7104
7484
|
\u2022 Coordinates are NOT geocoded by the backend \u2014 supply --pickup-lat/lng and --dropoff-lat/lng.
|
|
@@ -7128,6 +7508,7 @@ Key notes:
|
|
|
7128
7508
|
registerRideUpdateCommand(rideCmd, deps);
|
|
7129
7509
|
registerRideTripStatusCommand(rideCmd, deps);
|
|
7130
7510
|
registerListOrdersCommand(rideCmd, deps);
|
|
7511
|
+
registerRideCallbackCommands(rideCmd, deps);
|
|
7131
7512
|
const servicesCmd = program.command("services").description("Merchant service discovery");
|
|
7132
7513
|
registerServicesListCommand(servicesCmd, { discoveryClient, program });
|
|
7133
7514
|
registerServiceGetCommand(servicesCmd, { discoveryClient, program });
|
|
@@ -7137,6 +7518,7 @@ Key notes:
|
|
|
7137
7518
|
registerOrdersListCommand(ordersCmd, deps);
|
|
7138
7519
|
registerOrdersGetCommand(ordersCmd, deps);
|
|
7139
7520
|
registerOrdersPayBatchCommand(ordersCmd, deps);
|
|
7521
|
+
registerOrdersGetPaymentGroupCommand(ordersCmd, deps);
|
|
7140
7522
|
const hotelCmd = program.command("hotel-redaug").description(
|
|
7141
7523
|
`Hotel booking (Redaug) \u2014 international hotel search, quote, create-order, pay-order, cancel, and check-out.
|
|
7142
7524
|
|