@agenzo/merchant-cli 0.8.11 → 0.8.13
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 +343 -343
- package/dist/index.js +498 -155
- package/dist/index.js.map +1 -1
- package/package.json +28 -28
package/dist/index.js
CHANGED
|
@@ -1047,6 +1047,11 @@ var bookSchema = {
|
|
|
1047
1047
|
required: false,
|
|
1048
1048
|
description: "Bound payment method id to charge (pay_per_call only). Opaque id from `token payment-methods list`; ignored for monthly_settlement"
|
|
1049
1049
|
},
|
|
1050
|
+
"payment-token-id": {
|
|
1051
|
+
type: "string",
|
|
1052
|
+
required: false,
|
|
1053
|
+
description: "UPI Agent Pay: network-token id from an already-completed UnionPay/Visa capture. When set, the platform skips EVO preauth/capture and only books the ride + records this credential (funds already charged)"
|
|
1054
|
+
},
|
|
1050
1055
|
member: MEMBER_FLAG_SCHEMA,
|
|
1051
1056
|
"passenger-name": { type: "string", required: true, description: "Passenger full name" },
|
|
1052
1057
|
"passenger-phone": { type: "string", required: true, description: "Passenger phone in E.164 format (e.g. +14155551234)" },
|
|
@@ -1182,6 +1187,91 @@ var cancelSchema = {
|
|
|
1182
1187
|
PARAM_IDEMPOTENCY_KEY_REQUIRED: "Supply --idempotency-key (1-128 chars [A-Za-z0-9_-]); the CLI never generates one under --yes."
|
|
1183
1188
|
}
|
|
1184
1189
|
};
|
|
1190
|
+
var rideUpdateSchema = {
|
|
1191
|
+
cli: CLI_NAME,
|
|
1192
|
+
noun: NOUN,
|
|
1193
|
+
verb: "update",
|
|
1194
|
+
description: "Modify an existing ride booking: trip details (time / route / flight info) and/or passenger details. Fare changes are rejected \u2014 cancel and book again instead",
|
|
1195
|
+
flags: {
|
|
1196
|
+
"order-id": { type: "string", required: true, description: "The numeric ride_id (e.g. 4112961) to modify \u2014 use the `ride_id` field from book/list-orders responses, NOT the rio_... order_id" },
|
|
1197
|
+
"idempotency-key": {
|
|
1198
|
+
type: "string",
|
|
1199
|
+
required: true,
|
|
1200
|
+
description: "Unique key (1-128 chars [A-Za-z0-9_-]) forwarded verbatim as the Idempotency-Key header; never auto-generated"
|
|
1201
|
+
},
|
|
1202
|
+
"pickup-lat": { type: "float", required: false, description: "New pickup latitude", constraints: "-90 to 90" },
|
|
1203
|
+
"pickup-lng": { type: "float", required: false, description: "New pickup longitude", constraints: "-180 to 180" },
|
|
1204
|
+
"pickup-name": { type: "string", required: false, description: "New pickup location name" },
|
|
1205
|
+
"dropoff-lat": { type: "float", required: false, description: "New dropoff latitude", constraints: "-90 to 90" },
|
|
1206
|
+
"dropoff-lng": { type: "float", required: false, description: "New dropoff longitude", constraints: "-180 to 180" },
|
|
1207
|
+
"dropoff-name": { type: "string", required: false, description: "New dropoff location name" },
|
|
1208
|
+
"pickup-time": { type: "int|string", required: false, description: "New pickup time: epoch seconds or 'now'" },
|
|
1209
|
+
"welcome-sign": { type: "string", required: false, description: "New welcome sign text (meet & greet)" },
|
|
1210
|
+
"arrival-flight-no": { type: "string", required: false, description: "New arrival flight number" },
|
|
1211
|
+
"arrival-airline": { type: "string", required: false, description: "New arrival airline name" },
|
|
1212
|
+
"departure-flight-no": { type: "string", required: false, description: "New departure flight number" },
|
|
1213
|
+
"departure-airline": { type: "string", required: false, description: "New departure airline name" },
|
|
1214
|
+
"service-area-id": { type: "string", required: false, description: "Service area id, when the upstream requires re-scoping the ride" },
|
|
1215
|
+
"passenger-name": { type: "string", required: false, description: "New passenger full name (passing any passenger-* flag triggers a passenger update)" },
|
|
1216
|
+
"passenger-phone": { type: "string", required: false, description: "New passenger phone in E.164 format (e.g. +14155551234)" },
|
|
1217
|
+
"passenger-email": { type: "string", required: false, description: "New passenger email" },
|
|
1218
|
+
"luggage-count": { type: "int", required: false, description: "New luggage count" }
|
|
1219
|
+
},
|
|
1220
|
+
response: {
|
|
1221
|
+
ride_id: { type: "string|int", description: "Modified ride id" },
|
|
1222
|
+
status: { type: "string", description: "Result status, 'updated' when the modification was applied" },
|
|
1223
|
+
ride_updated: { type: "bool", description: "true when trip-side fields were sent upstream" },
|
|
1224
|
+
passenger_updated: { type: "bool", description: "true when passenger fields were sent upstream" }
|
|
1225
|
+
},
|
|
1226
|
+
example: {
|
|
1227
|
+
command: "agenzo-merchant-cli ride-elife update --order-id 4112961 --pickup-time 1780000000 --idempotency-key update-789",
|
|
1228
|
+
output_summary: "Returns which sides were applied (ride_updated / passenger_updated)."
|
|
1229
|
+
},
|
|
1230
|
+
error_recovery: {
|
|
1231
|
+
PARAM_INVALID: "No modifiable field was supplied. Pass at least one trip field or one passenger-* flag.",
|
|
1232
|
+
RIDE_NOT_FOUND: "The ride does not exist or belongs to another developer. Verify --order-id is the ride_id from book.",
|
|
1233
|
+
CANCELLATION_NOT_ALLOWED: "The ride is past the modifiable window. Query with `ride-elife get`; cancel and re-book if the user needs a different trip.",
|
|
1234
|
+
UPSTREAM_ERROR: "Partial update: one side applied upstream, the other failed (see data.partial_update). The upstream has NO rollback \u2014 re-issue update for the failed side ONLY, then confirm with `ride-elife get`.",
|
|
1235
|
+
PARAM_IDEMPOTENCY_KEY_REQUIRED: "Supply --idempotency-key (1-128 chars [A-Za-z0-9_-]); the CLI never generates one under --yes."
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
var rideTripStatusSchema = {
|
|
1239
|
+
cli: CLI_NAME,
|
|
1240
|
+
noun: NOUN,
|
|
1241
|
+
verb: "trip-status",
|
|
1242
|
+
description: "Query the status and driver location points of a single leg of a multi-leg ride",
|
|
1243
|
+
flags: {
|
|
1244
|
+
"order-id": { type: "string", required: true, description: "The numeric ride_id (e.g. 4112961) \u2014 use the `ride_id` field from book/list-orders responses" },
|
|
1245
|
+
"trip-no": { type: "int", required: false, default: 1, description: "1-based leg index; defaults to the first leg" }
|
|
1246
|
+
},
|
|
1247
|
+
response: {
|
|
1248
|
+
ride_id: { type: "string|int", description: "Ride identifier" },
|
|
1249
|
+
trip_no: { type: "int", description: "Leg number this status refers to" },
|
|
1250
|
+
status: { type: "string", description: "Leg status, same vocabulary as `ride-elife get`" },
|
|
1251
|
+
points: {
|
|
1252
|
+
type: "array|null",
|
|
1253
|
+
description: "Driver location points for this leg",
|
|
1254
|
+
items: { lat: { type: "float" }, lng: { type: "float" }, utc_timestamp: { type: "int" } }
|
|
1255
|
+
}
|
|
1256
|
+
},
|
|
1257
|
+
example: {
|
|
1258
|
+
command: "agenzo-merchant-cli ride-elife trip-status --order-id 4112961 --trip-no 2",
|
|
1259
|
+
output_summary: "Returns the leg status plus its driver location points."
|
|
1260
|
+
},
|
|
1261
|
+
polling: {
|
|
1262
|
+
recommended_interval_seconds: DEFAULT_WATCH_INTERVAL_SECONDS,
|
|
1263
|
+
terminal_statuses: [...TERMINAL_STATUSES],
|
|
1264
|
+
in_progress_statuses: ["Pending", "Accepted", "On my way", "Waiting", "On board"],
|
|
1265
|
+
field_availability: {
|
|
1266
|
+
points: "Populated only after the driver starts moving on this leg; empty or null before that."
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1269
|
+
error_recovery: {
|
|
1270
|
+
RIDE_NOT_FOUND: "The ride or the requested leg does not exist. Confirm the ride has multiple legs via `ride-elife get` first.",
|
|
1271
|
+
UPSTREAM_ERROR: "Upstream Trip Status errored. Legs only exist after a driver is dispatched \u2014 use get.response.next_trip_no and only query once the ride has started. As of 2026-08 the sandbox returns 502 here for rides with no dispatched legs regardless of --trip-no; fall back to `ride-elife get`.",
|
|
1272
|
+
BOOKING_FAILED: "Transient upstream error. Retry once after 5s, or fall back to `ride-elife get` for whole-ride status."
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1185
1275
|
var listOrdersSchema = {
|
|
1186
1276
|
cli: CLI_NAME,
|
|
1187
1277
|
noun: NOUN,
|
|
@@ -2105,12 +2195,15 @@ var flightCreateOrderSchema = flightSchema(
|
|
|
2105
2195
|
);
|
|
2106
2196
|
var flightPayOrderSchema = flightSchema(
|
|
2107
2197
|
"pay-order",
|
|
2108
|
-
"
|
|
2198
|
+
"Charge the order and trigger upstream ticketing. AWAITING_PAYMENT \u2192 PAID. Funds move HERE, not in create-order.",
|
|
2109
2199
|
{
|
|
2110
2200
|
"order-no": { type: "string", required: true, description: "Our order reference from create-order." },
|
|
2201
|
+
"payment-method-id": { type: "string", required: false, description: "Optional bound-card id to charge (pay_per_call only; omit to use the default card)." },
|
|
2202
|
+
"payment-token-id": { type: "string", required: false, description: "Optional network-token id; settles via direct charge instead of EVO preauth." },
|
|
2203
|
+
"authorized-merchant-trans-id": { type: "string", required: false, description: "Resume a 3DS challenge with an already-authorised preauth trans id." },
|
|
2111
2204
|
"idempotency-key": { type: "string", required: true, description: "Forwarded verbatim as the Idempotency-Key header." }
|
|
2112
2205
|
},
|
|
2113
|
-
{ order_no: { type: "string", description: "Our order reference." }, status: { type: "string", description: "PAID on success." } },
|
|
2206
|
+
{ order_no: { type: "string", description: "Our order reference." }, status: { type: "string", description: "PAID on success; AUTHENTICATION_REQUIRED when the card needs 3DS." } },
|
|
2114
2207
|
{ command: "agenzo-merchant-cli flight-flink pay-order --order-no ffo_... --idempotency-key k2", output_summary: "Order becomes PAID; poll get-order until TICKETED." }
|
|
2115
2208
|
);
|
|
2116
2209
|
var flightGetOrderSchema = flightSchema(
|
|
@@ -2450,6 +2543,9 @@ function registerBookCommand(parent, deps) {
|
|
|
2450
2543
|
const cmd = parent.command("book").description("Book a ride using a quote_id returned by quote").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--quote-id <id>", "Quote id from `ride-elife quote`").option("--vehicle-class <class>", "Chosen vehicle class").option("--price-amount <amount>", "Fare in decimal currency units (not cents)").option("--price-currency <currency>", "Currency code (default USD)").option("--payment-order-id <id>", "Paid payment order id (pay_per_call mode only)").option(
|
|
2451
2544
|
"--payment-method-id <id>",
|
|
2452
2545
|
"Bound payment method id to charge (pay_per_call mode only)"
|
|
2546
|
+
).option(
|
|
2547
|
+
"--payment-token-id <id>",
|
|
2548
|
+
"UPI Agent Pay: payment token id from an already-completed UnionPay/Visa network-token capture. When set, the platform skips EVO preauth/capture and only books the ride + records this credential (funds already charged)."
|
|
2453
2549
|
).option(
|
|
2454
2550
|
"--authorized-merchant-trans-id <id>",
|
|
2455
2551
|
"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)."
|
|
@@ -2477,6 +2573,7 @@ function registerBookCommand(parent, deps) {
|
|
|
2477
2573
|
};
|
|
2478
2574
|
if (opts.paymentOrderId) body.payment_order_id = opts.paymentOrderId;
|
|
2479
2575
|
if (opts.paymentMethodId) body.payment_method_id = opts.paymentMethodId;
|
|
2576
|
+
if (opts.paymentTokenId) body.payment_token_id = opts.paymentTokenId;
|
|
2480
2577
|
if (opts.authorizedMerchantTransId) {
|
|
2481
2578
|
body.authorized_merchant_trans_id = opts.authorizedMerchantTransId;
|
|
2482
2579
|
}
|
|
@@ -2730,6 +2827,225 @@ function registerCancelCommand(parent, deps) {
|
|
|
2730
2827
|
});
|
|
2731
2828
|
}
|
|
2732
2829
|
|
|
2830
|
+
// src/ride-elife/update.ts
|
|
2831
|
+
import { confirm as confirm3 } from "@inquirer/prompts";
|
|
2832
|
+
function need5(value, flag) {
|
|
2833
|
+
if (value === void 0) {
|
|
2834
|
+
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
2835
|
+
}
|
|
2836
|
+
return value;
|
|
2837
|
+
}
|
|
2838
|
+
function num3(value, flag) {
|
|
2839
|
+
if (value === void 0) return void 0;
|
|
2840
|
+
const parsed = Number(value);
|
|
2841
|
+
if (!Number.isFinite(parsed)) {
|
|
2842
|
+
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
2843
|
+
}
|
|
2844
|
+
return parsed;
|
|
2845
|
+
}
|
|
2846
|
+
function int(value, flag) {
|
|
2847
|
+
const parsed = num3(value, flag);
|
|
2848
|
+
if (parsed === void 0) return void 0;
|
|
2849
|
+
if (!Number.isInteger(parsed)) {
|
|
2850
|
+
throw new CliError("PARAM_INVALID", `--${flag} must be an integer.`);
|
|
2851
|
+
}
|
|
2852
|
+
return parsed;
|
|
2853
|
+
}
|
|
2854
|
+
function pickupTime(value) {
|
|
2855
|
+
if (value === void 0) return void 0;
|
|
2856
|
+
if (value === "now") return "now";
|
|
2857
|
+
const parsed = Number(value);
|
|
2858
|
+
if (!Number.isInteger(parsed)) {
|
|
2859
|
+
throw new CliError("PARAM_INVALID", "--pickup-time must be epoch seconds or 'now'.");
|
|
2860
|
+
}
|
|
2861
|
+
return parsed;
|
|
2862
|
+
}
|
|
2863
|
+
function location(lat, lng, name, side) {
|
|
2864
|
+
if (lat === void 0 && lng === void 0 && name === void 0) return void 0;
|
|
2865
|
+
if (lat === void 0 || lng === void 0 || name === void 0) {
|
|
2866
|
+
throw new CliError(
|
|
2867
|
+
"PARAM_INVALID",
|
|
2868
|
+
`--${side}-lat, --${side}-lng and --${side}-name must be passed together.`
|
|
2869
|
+
);
|
|
2870
|
+
}
|
|
2871
|
+
return {
|
|
2872
|
+
lat: num3(lat, `${side}-lat`),
|
|
2873
|
+
lng: num3(lng, `${side}-lng`),
|
|
2874
|
+
name
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
function formatUpdate(data) {
|
|
2878
|
+
return Formatter.keyValue([
|
|
2879
|
+
["Ride ID", String(data.ride_id ?? "-")],
|
|
2880
|
+
["Status", String(data.status ?? "-")],
|
|
2881
|
+
["Trip details updated", data.ride_updated ? "yes" : "no"],
|
|
2882
|
+
["Passenger updated", data.passenger_updated ? "yes" : "no"]
|
|
2883
|
+
]);
|
|
2884
|
+
}
|
|
2885
|
+
function registerRideUpdateCommand(parent, deps) {
|
|
2886
|
+
const cmd = parent.command("update").description("Modify an existing ride order (trip details and/or passenger)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-id <id>", "Ride order id to modify (the ride_id returned by book)").option(
|
|
2887
|
+
"--idempotency-key <key>",
|
|
2888
|
+
"Idempotency key forwarded verbatim as the Idempotency-Key header"
|
|
2889
|
+
).option("--quote-id <id>", "New quote id when the fare changes").option("--vehicle-class <class>", "New vehicle class").option("--price-amount <amount>", "New fare in decimal currency units (NOT cents)").option("--price-currency <code>", "ISO 4217 currency code for the new fare").option("--pickup-lat <lat>", "New pickup latitude").option("--pickup-lng <lng>", "New pickup longitude").option("--pickup-name <name>", "New pickup location name").option("--dropoff-lat <lat>", "New dropoff latitude").option("--dropoff-lng <lng>", "New dropoff longitude").option("--dropoff-name <name>", "New dropoff location name").option("--pickup-time <time>", "New pickup time: epoch seconds or 'now'").option("--meet-and-greet", "Enable meet & greet service").option("--no-meet-and-greet", "Disable meet & greet service").option("--welcome-sign <text>", "New welcome sign text (meet & greet)").option("--arrival-flight-no <no>", "New arrival flight number").option("--arrival-airline <name>", "New arrival airline name").option("--departure-flight-no <no>", "New departure flight number").option("--departure-airline <name>", "New departure airline name").option("--service-area-id <id>", "Service area id, when the upstream requires re-scoping").option("--passenger-name <name>", "New passenger full name").option("--passenger-phone <phone>", "New passenger phone (E.164)").option("--passenger-email <email>", "New passenger email").option("--luggage-count <count>", "New luggage count");
|
|
2890
|
+
attachSchemaHelp(cmd, rideUpdateSchema);
|
|
2891
|
+
cmd.action(async () => {
|
|
2892
|
+
const opts = cmd.optsWithGlobals();
|
|
2893
|
+
const format = resolveFormat(opts.format);
|
|
2894
|
+
const isYes = Boolean(opts.yes);
|
|
2895
|
+
const apiKey = await PromptEngine.resolveInput(opts.apiKey, {
|
|
2896
|
+
message: "API Key:",
|
|
2897
|
+
type: "password"
|
|
2898
|
+
});
|
|
2899
|
+
const orderId = need5(opts.orderId, "order-id");
|
|
2900
|
+
const mgTouched = process.argv.some(
|
|
2901
|
+
(a) => a === "--meet-and-greet" || a === "--no-meet-and-greet"
|
|
2902
|
+
);
|
|
2903
|
+
const body = {};
|
|
2904
|
+
const set = (key, value) => {
|
|
2905
|
+
if (value !== void 0) body[key] = value;
|
|
2906
|
+
};
|
|
2907
|
+
set("quote_id", opts.quoteId);
|
|
2908
|
+
set("vehicle_class", opts.vehicleClass);
|
|
2909
|
+
set("price_amount", num3(opts.priceAmount, "price-amount"));
|
|
2910
|
+
set("price_currency", opts.priceCurrency);
|
|
2911
|
+
set(
|
|
2912
|
+
"pickup",
|
|
2913
|
+
location(
|
|
2914
|
+
opts.pickupLat,
|
|
2915
|
+
opts.pickupLng,
|
|
2916
|
+
opts.pickupName,
|
|
2917
|
+
"pickup"
|
|
2918
|
+
)
|
|
2919
|
+
);
|
|
2920
|
+
set(
|
|
2921
|
+
"dropoff",
|
|
2922
|
+
location(
|
|
2923
|
+
opts.dropoffLat,
|
|
2924
|
+
opts.dropoffLng,
|
|
2925
|
+
opts.dropoffName,
|
|
2926
|
+
"dropoff"
|
|
2927
|
+
)
|
|
2928
|
+
);
|
|
2929
|
+
set("pickup_time", pickupTime(opts.pickupTime));
|
|
2930
|
+
if (mgTouched) set("meet_and_greet", Boolean(opts.meetAndGreet));
|
|
2931
|
+
set("welcome_sign", opts.welcomeSign);
|
|
2932
|
+
if (opts.arrivalFlightNo !== void 0 || opts.arrivalAirline !== void 0) {
|
|
2933
|
+
set("arrival_flight", {
|
|
2934
|
+
flight_no: opts.arrivalFlightNo,
|
|
2935
|
+
airline: opts.arrivalAirline
|
|
2936
|
+
});
|
|
2937
|
+
}
|
|
2938
|
+
if (opts.departureFlightNo !== void 0 || opts.departureAirline !== void 0) {
|
|
2939
|
+
set("departure_flight", {
|
|
2940
|
+
flight_no: opts.departureFlightNo,
|
|
2941
|
+
airline: opts.departureAirline
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
set("service_area_id", opts.serviceAreaId);
|
|
2945
|
+
set("passenger_name", opts.passengerName);
|
|
2946
|
+
set("passenger_phone", opts.passengerPhone);
|
|
2947
|
+
set("passenger_email", opts.passengerEmail);
|
|
2948
|
+
set("luggage_count", int(opts.luggageCount, "luggage-count"));
|
|
2949
|
+
if (Object.keys(body).length === 0) {
|
|
2950
|
+
throw new CliError(
|
|
2951
|
+
"PARAM_INVALID",
|
|
2952
|
+
"Nothing to update. Pass at least one trip field or one passenger-* flag."
|
|
2953
|
+
);
|
|
2954
|
+
}
|
|
2955
|
+
if (!isYes) {
|
|
2956
|
+
const confirmed = await confirm3({
|
|
2957
|
+
message: `Apply ${Object.keys(body).length} change(s) to ride ${orderId}? The fare may change.`,
|
|
2958
|
+
default: false
|
|
2959
|
+
});
|
|
2960
|
+
if (!confirmed) {
|
|
2961
|
+
throw new CliError("CLIENT_ABORTED", "Update aborted by user.");
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
2965
|
+
yes: isYes,
|
|
2966
|
+
commandPath: "ride-elife update"
|
|
2967
|
+
});
|
|
2968
|
+
const spinner = format === "json" ? null : createSpinner("Updating ride...");
|
|
2969
|
+
const result = await deps.apiClient.post(
|
|
2970
|
+
`/ride/${encodeURIComponent(orderId)}/update`,
|
|
2971
|
+
{ type: "api-key", key: apiKey },
|
|
2972
|
+
body,
|
|
2973
|
+
{ "Idempotency-Key": idempotencyKey }
|
|
2974
|
+
);
|
|
2975
|
+
spinner?.stop();
|
|
2976
|
+
if (!result.success) {
|
|
2977
|
+
throw CliError.fromApi(result, { auth: "api-key" });
|
|
2978
|
+
}
|
|
2979
|
+
const data = result.data;
|
|
2980
|
+
const configManager = new ConfigManager();
|
|
2981
|
+
const commandResult = {
|
|
2982
|
+
data,
|
|
2983
|
+
text: () => formatUpdate(data)
|
|
2984
|
+
};
|
|
2985
|
+
await renderWithContext(commandResult, { format }, configManager);
|
|
2986
|
+
});
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
// src/ride-elife/trip-status.ts
|
|
2990
|
+
function need6(value, flag) {
|
|
2991
|
+
if (value === void 0) {
|
|
2992
|
+
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
2993
|
+
}
|
|
2994
|
+
return value;
|
|
2995
|
+
}
|
|
2996
|
+
function tripNo(value) {
|
|
2997
|
+
if (value === void 0) return 1;
|
|
2998
|
+
const parsed = Number(value);
|
|
2999
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
3000
|
+
throw new CliError("PARAM_INVALID", "--trip-no must be an integer >= 1.");
|
|
3001
|
+
}
|
|
3002
|
+
return parsed;
|
|
3003
|
+
}
|
|
3004
|
+
function formatTripStatus(data) {
|
|
3005
|
+
const lines = [
|
|
3006
|
+
["Ride ID", String(data.ride_id ?? "-")],
|
|
3007
|
+
["Trip no", String(data.trip_no ?? "-")],
|
|
3008
|
+
["Status", String(data.status ?? "-")]
|
|
3009
|
+
];
|
|
3010
|
+
const points = data.points ?? [];
|
|
3011
|
+
lines.push(["Location points", String(points.length)]);
|
|
3012
|
+
const latest = points[points.length - 1];
|
|
3013
|
+
if (latest) {
|
|
3014
|
+
lines.push(["Latest position", `${latest.lat}, ${latest.lng} @ ${latest.utc_timestamp}`]);
|
|
3015
|
+
}
|
|
3016
|
+
return Formatter.keyValue(lines);
|
|
3017
|
+
}
|
|
3018
|
+
function registerRideTripStatusCommand(parent, deps) {
|
|
3019
|
+
const cmd = parent.command("trip-status").description("Retrieve the status and driver location points of one leg of a ride").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-id <id>", "Ride order id (the ride_id returned by `ride-elife book`)").option("--trip-no <no>", "1-based leg index (default 1)");
|
|
3020
|
+
attachSchemaHelp(cmd, rideTripStatusSchema);
|
|
3021
|
+
cmd.action(async () => {
|
|
3022
|
+
const opts = cmd.optsWithGlobals();
|
|
3023
|
+
const format = resolveFormat(opts.format);
|
|
3024
|
+
const apiKey = await PromptEngine.resolveInput(opts.apiKey, {
|
|
3025
|
+
message: "API Key:",
|
|
3026
|
+
type: "password"
|
|
3027
|
+
});
|
|
3028
|
+
const orderId = need6(opts.orderId, "order-id");
|
|
3029
|
+
const leg = tripNo(opts.tripNo);
|
|
3030
|
+
const spinner = format === "json" ? null : createSpinner("Fetching trip status...");
|
|
3031
|
+
const result = await deps.apiClient.get(
|
|
3032
|
+
`/ride/${encodeURIComponent(orderId)}/trips/${leg}`,
|
|
3033
|
+
{ type: "api-key", key: apiKey }
|
|
3034
|
+
);
|
|
3035
|
+
spinner?.stop();
|
|
3036
|
+
if (!result.success) {
|
|
3037
|
+
throw CliError.fromApi(result, { auth: "api-key" });
|
|
3038
|
+
}
|
|
3039
|
+
const data = result.data;
|
|
3040
|
+
const configManager = new ConfigManager();
|
|
3041
|
+
const commandResult = {
|
|
3042
|
+
data,
|
|
3043
|
+
text: () => formatTripStatus(data)
|
|
3044
|
+
};
|
|
3045
|
+
await renderWithContext(commandResult, { format }, configManager);
|
|
3046
|
+
});
|
|
3047
|
+
}
|
|
3048
|
+
|
|
2733
3049
|
// src/ride-elife/list-orders.ts
|
|
2734
3050
|
var DEFAULT_PAGE = "1";
|
|
2735
3051
|
var DEFAULT_PAGE_SIZE = "20";
|
|
@@ -2814,15 +3130,24 @@ var SERVICE_REGISTRY = [
|
|
|
2814
3130
|
version: "1.0.0",
|
|
2815
3131
|
provider: "elife",
|
|
2816
3132
|
cli_noun: "ride-elife",
|
|
2817
|
-
verbs: ["quote", "book", "get", "cancel", "list-orders"],
|
|
3133
|
+
verbs: ["quote", "book", "get", "cancel", "update", "trip-status", "list-orders"],
|
|
2818
3134
|
verb_descriptions: {
|
|
2819
3135
|
quote: "Request fare quotes for a ride between two points.",
|
|
2820
3136
|
book: "Book a ride using a quote_id returned by quote.",
|
|
2821
3137
|
get: "Retrieve a ride order by id (poll for status changes with --watch).",
|
|
2822
3138
|
cancel: "Cancel a ride order by id (may incur a fee).",
|
|
3139
|
+
update: "Modify a booked ride: trip details and/or passenger info.",
|
|
3140
|
+
"trip-status": "Retrieve status and driver location points for one leg of a multi-leg ride.",
|
|
2823
3141
|
"list-orders": "List previously placed ride orders."
|
|
2824
3142
|
},
|
|
2825
|
-
workflow: [
|
|
3143
|
+
workflow: [
|
|
3144
|
+
"quote",
|
|
3145
|
+
"book",
|
|
3146
|
+
"get (poll for status)",
|
|
3147
|
+
"update (optional)",
|
|
3148
|
+
"trip-status (optional, multi-leg rides)",
|
|
3149
|
+
"cancel (optional)"
|
|
3150
|
+
],
|
|
2826
3151
|
since: "2026-06-01",
|
|
2827
3152
|
discovery: {
|
|
2828
3153
|
help_command: "agenzo-merchant-cli ride-elife --help"
|
|
@@ -3229,28 +3554,28 @@ function registerOrdersGetCommand(parent, deps) {
|
|
|
3229
3554
|
}
|
|
3230
3555
|
|
|
3231
3556
|
// src/hotel-redaug/search.ts
|
|
3232
|
-
function
|
|
3557
|
+
function need7(value, flag) {
|
|
3233
3558
|
if (value === void 0) {
|
|
3234
3559
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
3235
3560
|
}
|
|
3236
3561
|
return value;
|
|
3237
3562
|
}
|
|
3238
|
-
function
|
|
3239
|
-
const n = Number(
|
|
3563
|
+
function num4(value, flag) {
|
|
3564
|
+
const n = Number(need7(value, flag));
|
|
3240
3565
|
if (!Number.isFinite(n)) {
|
|
3241
3566
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
3242
3567
|
}
|
|
3243
3568
|
return n;
|
|
3244
3569
|
}
|
|
3245
3570
|
function coord(value, flag, min, max) {
|
|
3246
|
-
const n =
|
|
3571
|
+
const n = num4(value, flag);
|
|
3247
3572
|
if (n < min || n > max) {
|
|
3248
3573
|
throw new CliError("PARAM_INVALID", `--${flag} must be between ${min} and ${max}.`);
|
|
3249
3574
|
}
|
|
3250
3575
|
return n;
|
|
3251
3576
|
}
|
|
3252
3577
|
function positiveInt3(value, flag) {
|
|
3253
|
-
const n =
|
|
3578
|
+
const n = num4(value, flag);
|
|
3254
3579
|
if (!Number.isInteger(n) || n <= 0) {
|
|
3255
3580
|
throw new CliError("PARAM_INVALID", `--${flag} must be a positive integer.`);
|
|
3256
3581
|
}
|
|
@@ -3258,7 +3583,7 @@ function positiveInt3(value, flag) {
|
|
|
3258
3583
|
}
|
|
3259
3584
|
var YMD_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
3260
3585
|
function stayDate(value, flag) {
|
|
3261
|
-
const raw =
|
|
3586
|
+
const raw = need7(value, flag);
|
|
3262
3587
|
if (!YMD_RE.test(raw)) {
|
|
3263
3588
|
throw new CliError("PARAM_INVALID", `--${flag} must be a YYYY-MM-DD date.`);
|
|
3264
3589
|
}
|
|
@@ -3330,21 +3655,21 @@ function registerHotelSearchCommand(parent, deps) {
|
|
|
3330
3655
|
const pageSize = positiveInt3(opts.pageSize, "page-size");
|
|
3331
3656
|
const body = {};
|
|
3332
3657
|
if (hasDestination) {
|
|
3333
|
-
body.destination_id =
|
|
3658
|
+
body.destination_id = need7(opts.destinationId, "destination-id");
|
|
3334
3659
|
} else {
|
|
3335
3660
|
body.lat = coord(opts.lat, "lat", -90, 90);
|
|
3336
3661
|
body.lng = coord(opts.lng, "lng", -180, 180);
|
|
3337
3662
|
}
|
|
3338
|
-
body.distance =
|
|
3663
|
+
body.distance = num4(opts.distance, "distance");
|
|
3339
3664
|
body.check_in = checkIn;
|
|
3340
3665
|
body.check_out = checkOut;
|
|
3341
|
-
body.adults =
|
|
3342
|
-
body.children =
|
|
3343
|
-
body.room_num =
|
|
3344
|
-
if (opts.star !== void 0) body.star =
|
|
3666
|
+
body.adults = num4(opts.adults, "adults");
|
|
3667
|
+
body.children = num4(opts.children, "children");
|
|
3668
|
+
body.room_num = num4(opts.roomNum, "room-num");
|
|
3669
|
+
if (opts.star !== void 0) body.star = num4(opts.star, "star");
|
|
3345
3670
|
if (opts.keyword !== void 0) body.keyword = opts.keyword;
|
|
3346
|
-
if (opts.priceMin !== void 0) body.price_min =
|
|
3347
|
-
if (opts.priceMax !== void 0) body.price_max =
|
|
3671
|
+
if (opts.priceMin !== void 0) body.price_min = num4(opts.priceMin, "price-min");
|
|
3672
|
+
if (opts.priceMax !== void 0) body.price_max = num4(opts.priceMax, "price-max");
|
|
3348
3673
|
if (opts.sortBy !== void 0) body.sort_by = opts.sortBy;
|
|
3349
3674
|
body.page = page;
|
|
3350
3675
|
body.page_size = pageSize;
|
|
@@ -3373,14 +3698,14 @@ function registerHotelSearchCommand(parent, deps) {
|
|
|
3373
3698
|
}
|
|
3374
3699
|
|
|
3375
3700
|
// src/hotel-redaug/quote.ts
|
|
3376
|
-
function
|
|
3701
|
+
function need8(value, flag) {
|
|
3377
3702
|
if (value === void 0) {
|
|
3378
3703
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
3379
3704
|
}
|
|
3380
3705
|
return value;
|
|
3381
3706
|
}
|
|
3382
|
-
function
|
|
3383
|
-
const n = Number(
|
|
3707
|
+
function num5(value, flag) {
|
|
3708
|
+
const n = Number(need8(value, flag));
|
|
3384
3709
|
if (!Number.isFinite(n)) {
|
|
3385
3710
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
3386
3711
|
}
|
|
@@ -3388,7 +3713,7 @@ function num4(value, flag) {
|
|
|
3388
3713
|
}
|
|
3389
3714
|
var YMD_RE2 = /^\d{4}-\d{2}-\d{2}$/;
|
|
3390
3715
|
function stayDate2(value, flag) {
|
|
3391
|
-
const raw =
|
|
3716
|
+
const raw = need8(value, flag);
|
|
3392
3717
|
if (!YMD_RE2.test(raw)) {
|
|
3393
3718
|
throw new CliError("PARAM_INVALID", `--${flag} must be a YYYY-MM-DD date.`);
|
|
3394
3719
|
}
|
|
@@ -3428,7 +3753,7 @@ function registerHotelQuoteCommand(parent, deps) {
|
|
|
3428
3753
|
message: "API Key:",
|
|
3429
3754
|
type: "password"
|
|
3430
3755
|
});
|
|
3431
|
-
const hotelId =
|
|
3756
|
+
const hotelId = need8(opts.hotelId, "hotel-id");
|
|
3432
3757
|
const checkIn = stayDate2(opts.checkIn, "check-in");
|
|
3433
3758
|
const checkOut = stayDate2(opts.checkOut, "check-out");
|
|
3434
3759
|
if (!(checkOut > checkIn)) {
|
|
@@ -3438,9 +3763,9 @@ function registerHotelQuoteCommand(parent, deps) {
|
|
|
3438
3763
|
hotel_id: hotelId,
|
|
3439
3764
|
check_in: checkIn,
|
|
3440
3765
|
check_out: checkOut,
|
|
3441
|
-
adults:
|
|
3442
|
-
children:
|
|
3443
|
-
room_num:
|
|
3766
|
+
adults: num5(opts.adults, "adults"),
|
|
3767
|
+
children: num5(opts.children, "children"),
|
|
3768
|
+
room_num: num5(opts.roomNum, "room-num"),
|
|
3444
3769
|
nationality: opts.nationality
|
|
3445
3770
|
};
|
|
3446
3771
|
const result = await deps.apiClient.post(
|
|
@@ -3462,7 +3787,7 @@ function registerHotelQuoteCommand(parent, deps) {
|
|
|
3462
3787
|
}
|
|
3463
3788
|
|
|
3464
3789
|
// src/hotel-redaug/create-order.ts
|
|
3465
|
-
import { confirm as
|
|
3790
|
+
import { confirm as confirm4 } from "@inquirer/prompts";
|
|
3466
3791
|
function parsePriceItems(raw) {
|
|
3467
3792
|
const INVALID = "--price-items must be a JSON array of {sale_date (string), sale_price (number), breakfast_num (number)}.";
|
|
3468
3793
|
let parsed;
|
|
@@ -3520,14 +3845,14 @@ function parseCancellation(raw) {
|
|
|
3520
3845
|
}
|
|
3521
3846
|
return parsed;
|
|
3522
3847
|
}
|
|
3523
|
-
function
|
|
3848
|
+
function need9(value, flag) {
|
|
3524
3849
|
if (value === void 0) {
|
|
3525
3850
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
3526
3851
|
}
|
|
3527
3852
|
return value;
|
|
3528
3853
|
}
|
|
3529
|
-
function
|
|
3530
|
-
const n = Number(
|
|
3854
|
+
function num6(value, flag) {
|
|
3855
|
+
const n = Number(need9(value, flag));
|
|
3531
3856
|
if (!Number.isFinite(n)) {
|
|
3532
3857
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
3533
3858
|
}
|
|
@@ -3535,7 +3860,7 @@ function num5(value, flag) {
|
|
|
3535
3860
|
}
|
|
3536
3861
|
var YMD_RE3 = /^\d{4}-\d{2}-\d{2}$/;
|
|
3537
3862
|
function stayDate3(value, flag) {
|
|
3538
|
-
const raw =
|
|
3863
|
+
const raw = need9(value, flag);
|
|
3539
3864
|
if (!YMD_RE3.test(raw)) {
|
|
3540
3865
|
throw new CliError("PARAM_INVALID", `--${flag} must be a YYYY-MM-DD date.`);
|
|
3541
3866
|
}
|
|
@@ -3604,18 +3929,18 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3604
3929
|
message: "API Key:",
|
|
3605
3930
|
type: "password"
|
|
3606
3931
|
});
|
|
3607
|
-
const productToken =
|
|
3608
|
-
const totalAmount =
|
|
3609
|
-
const currency =
|
|
3610
|
-
const priceItems = parsePriceItems(
|
|
3932
|
+
const productToken = need9(opts.productToken, "product-token");
|
|
3933
|
+
const totalAmount = num6(opts.totalAmount, "total-amount");
|
|
3934
|
+
const currency = need9(opts.currency, "currency");
|
|
3935
|
+
const priceItems = parsePriceItems(need9(opts.priceItems, "price-items"));
|
|
3611
3936
|
const checkIn = stayDate3(opts.checkIn, "check-in");
|
|
3612
3937
|
const checkOut = stayDate3(opts.checkOut, "check-out");
|
|
3613
3938
|
if (!(checkOut > checkIn)) {
|
|
3614
3939
|
throw new CliError("PARAM_INVALID", "--check-out must be strictly after --check-in.");
|
|
3615
3940
|
}
|
|
3616
|
-
const guestName =
|
|
3617
|
-
const contactName =
|
|
3618
|
-
const contactPhone =
|
|
3941
|
+
const guestName = need9(opts.guestName, "guest-name");
|
|
3942
|
+
const contactName = need9(opts.contactName, "contact-name");
|
|
3943
|
+
const contactPhone = need9(opts.contactPhone, "contact-phone");
|
|
3619
3944
|
const body = {
|
|
3620
3945
|
product_token: productToken,
|
|
3621
3946
|
total_amount: totalAmount,
|
|
@@ -3623,9 +3948,9 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3623
3948
|
price_items: priceItems,
|
|
3624
3949
|
check_in: checkIn,
|
|
3625
3950
|
check_out: checkOut,
|
|
3626
|
-
room_num:
|
|
3627
|
-
adults:
|
|
3628
|
-
children:
|
|
3951
|
+
room_num: num6(opts.roomNum, "room-num"),
|
|
3952
|
+
adults: num6(opts.adults, "adults"),
|
|
3953
|
+
children: num6(opts.children, "children"),
|
|
3629
3954
|
nationality: opts.nationality,
|
|
3630
3955
|
guest_name: guestName,
|
|
3631
3956
|
contact_name: contactName,
|
|
@@ -3649,7 +3974,7 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3649
3974
|
if (member !== void 0) body.member_id = member;
|
|
3650
3975
|
if (!isYes) {
|
|
3651
3976
|
const chargeNote = opts.paymentTokenId !== void 0 ? "Payment has already been captured via UPI Agent Pay; this only locks the room." : "This locks the rate but does NOT charge anything yet.";
|
|
3652
|
-
const confirmed = await
|
|
3977
|
+
const confirmed = await confirm4({
|
|
3653
3978
|
message: `Create this hotel order for ${totalAmount} ${currency} (check-in ${checkIn}, check-out ${checkOut})? ${chargeNote}`,
|
|
3654
3979
|
default: false
|
|
3655
3980
|
});
|
|
@@ -3683,7 +4008,7 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3683
4008
|
}
|
|
3684
4009
|
|
|
3685
4010
|
// src/hotel-redaug/pay-order.ts
|
|
3686
|
-
import { confirm as
|
|
4011
|
+
import { confirm as confirm5 } from "@inquirer/prompts";
|
|
3687
4012
|
|
|
3688
4013
|
// src/hotel-redaug/watch.ts
|
|
3689
4014
|
var DEFAULT_ORDER_WATCH_INTERVAL_SECONDS = 5;
|
|
@@ -3859,7 +4184,7 @@ function registerHotelPayOrderCommand(parent, deps) {
|
|
|
3859
4184
|
const watchTimeout = resolveSeconds(opts.watchTimeout, DEFAULT_PAY_WATCH_TIMEOUT_SECONDS);
|
|
3860
4185
|
const body = {};
|
|
3861
4186
|
if (!isYes) {
|
|
3862
|
-
const confirmed = await
|
|
4187
|
+
const confirmed = await confirm5({
|
|
3863
4188
|
message: `Settle hotel order ${orderId}? This moves money via the order's configured billing mode (monthly_settlement or pay_per_call).`,
|
|
3864
4189
|
default: false
|
|
3865
4190
|
});
|
|
@@ -3937,7 +4262,7 @@ function registerHotelPayOrderCommand(parent, deps) {
|
|
|
3937
4262
|
}
|
|
3938
4263
|
|
|
3939
4264
|
// src/hotel-redaug/get.ts
|
|
3940
|
-
function
|
|
4265
|
+
function need10(value, flag) {
|
|
3941
4266
|
if (value === void 0) {
|
|
3942
4267
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
3943
4268
|
}
|
|
@@ -4001,7 +4326,7 @@ function registerHotelGetCommand(parent, deps) {
|
|
|
4001
4326
|
message: "API Key:",
|
|
4002
4327
|
type: "password"
|
|
4003
4328
|
});
|
|
4004
|
-
const orderId =
|
|
4329
|
+
const orderId = need10(opts.orderId, "order-id");
|
|
4005
4330
|
if (opts.watch) {
|
|
4006
4331
|
await watchOrderStatus(deps.apiClient, apiKey, orderId, {
|
|
4007
4332
|
intervalSeconds: resolveSeconds(
|
|
@@ -4035,7 +4360,7 @@ function registerHotelGetCommand(parent, deps) {
|
|
|
4035
4360
|
}
|
|
4036
4361
|
|
|
4037
4362
|
// src/hotel-redaug/cancel.ts
|
|
4038
|
-
function
|
|
4363
|
+
function need11(value, flag) {
|
|
4039
4364
|
if (value === void 0) {
|
|
4040
4365
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4041
4366
|
}
|
|
@@ -4088,8 +4413,8 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
4088
4413
|
message: "API Key:",
|
|
4089
4414
|
type: "password"
|
|
4090
4415
|
});
|
|
4091
|
-
const orderId =
|
|
4092
|
-
const fcOrderCode =
|
|
4416
|
+
const orderId = need11(opts.orderId, "order-id");
|
|
4417
|
+
const fcOrderCode = need11(opts.fcOrderCode, "fc-order-code");
|
|
4093
4418
|
const body = { fc_order_code: fcOrderCode };
|
|
4094
4419
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
4095
4420
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -4118,15 +4443,15 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
4118
4443
|
}
|
|
4119
4444
|
|
|
4120
4445
|
// src/hotel-redaug/checkout.ts
|
|
4121
|
-
import { confirm as
|
|
4122
|
-
function
|
|
4446
|
+
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
4447
|
+
function need12(value, flag) {
|
|
4123
4448
|
if (value === void 0) {
|
|
4124
4449
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4125
4450
|
}
|
|
4126
4451
|
return value;
|
|
4127
4452
|
}
|
|
4128
|
-
function
|
|
4129
|
-
const n = Number(
|
|
4453
|
+
function num7(value, flag) {
|
|
4454
|
+
const n = Number(need12(value, flag));
|
|
4130
4455
|
if (!Number.isFinite(n)) {
|
|
4131
4456
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4132
4457
|
}
|
|
@@ -4192,11 +4517,11 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
4192
4517
|
message: "API Key:",
|
|
4193
4518
|
type: "password"
|
|
4194
4519
|
});
|
|
4195
|
-
const orderId =
|
|
4196
|
-
const fcOrderCode =
|
|
4197
|
-
const reason =
|
|
4198
|
-
const checkoutRooms = parseCheckoutRooms(
|
|
4199
|
-
const refundType =
|
|
4520
|
+
const orderId = need12(opts.orderId, "order-id");
|
|
4521
|
+
const fcOrderCode = need12(opts.fcOrderCode, "fc-order-code");
|
|
4522
|
+
const reason = need12(opts.reason, "reason");
|
|
4523
|
+
const checkoutRooms = parseCheckoutRooms(need12(opts.checkoutRooms, "checkout-rooms"));
|
|
4524
|
+
const refundType = num7(opts.refundType, "refund-type");
|
|
4200
4525
|
const body = {
|
|
4201
4526
|
fc_order_code: fcOrderCode,
|
|
4202
4527
|
reason,
|
|
@@ -4204,7 +4529,7 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
4204
4529
|
checkout_rooms: checkoutRooms
|
|
4205
4530
|
};
|
|
4206
4531
|
if (!isYes) {
|
|
4207
|
-
const confirmed = await
|
|
4532
|
+
const confirmed = await confirm6({
|
|
4208
4533
|
message: `Request check-out / out-of-policy cancellation for order ${orderId} (${checkoutRooms.length} room(s))? The property must approve and charges may apply.`,
|
|
4209
4534
|
default: false
|
|
4210
4535
|
});
|
|
@@ -4238,7 +4563,7 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
4238
4563
|
}
|
|
4239
4564
|
|
|
4240
4565
|
// src/hotel-redaug/get-checkout.ts
|
|
4241
|
-
function
|
|
4566
|
+
function need13(value, flag) {
|
|
4242
4567
|
if (value === void 0) {
|
|
4243
4568
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4244
4569
|
}
|
|
@@ -4274,7 +4599,7 @@ function registerHotelGetCheckoutCommand(parent, deps) {
|
|
|
4274
4599
|
message: "API Key:",
|
|
4275
4600
|
type: "password"
|
|
4276
4601
|
});
|
|
4277
|
-
const taskOrderCode =
|
|
4602
|
+
const taskOrderCode = need13(opts.taskOrderCode, "task-order-code");
|
|
4278
4603
|
if (opts.watch) {
|
|
4279
4604
|
await watchCheckoutStatus(deps.apiClient, apiKey, taskOrderCode, {
|
|
4280
4605
|
intervalSeconds: resolveSeconds(
|
|
@@ -4378,7 +4703,7 @@ function registerHotelListOrdersCommand(parent, deps) {
|
|
|
4378
4703
|
}
|
|
4379
4704
|
|
|
4380
4705
|
// src/hotel-redaug/find-destination.ts
|
|
4381
|
-
function
|
|
4706
|
+
function need14(value, flag) {
|
|
4382
4707
|
if (value === void 0 || value.trim() === "") {
|
|
4383
4708
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4384
4709
|
}
|
|
@@ -4412,7 +4737,7 @@ function registerHotelFindDestinationCommand(parent, deps) {
|
|
|
4412
4737
|
message: "API Key:",
|
|
4413
4738
|
type: "password"
|
|
4414
4739
|
});
|
|
4415
|
-
const keyword =
|
|
4740
|
+
const keyword = need14(opts.keyword, "keyword");
|
|
4416
4741
|
const body = { keyword };
|
|
4417
4742
|
if (opts.dataType !== void 0) {
|
|
4418
4743
|
body.data_type = opts.dataType;
|
|
@@ -4436,21 +4761,21 @@ function registerHotelFindDestinationCommand(parent, deps) {
|
|
|
4436
4761
|
}
|
|
4437
4762
|
|
|
4438
4763
|
// src/hotel-redaug/hotel-filters.ts
|
|
4439
|
-
function
|
|
4764
|
+
function need15(value, flag) {
|
|
4440
4765
|
if (value === void 0 || value.trim() === "") {
|
|
4441
4766
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4442
4767
|
}
|
|
4443
4768
|
return value;
|
|
4444
4769
|
}
|
|
4445
|
-
function
|
|
4446
|
-
const n = Number(
|
|
4770
|
+
function num8(value, flag) {
|
|
4771
|
+
const n = Number(need15(value, flag));
|
|
4447
4772
|
if (!Number.isFinite(n)) {
|
|
4448
4773
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4449
4774
|
}
|
|
4450
4775
|
return n;
|
|
4451
4776
|
}
|
|
4452
4777
|
function coord2(value, flag, min, max) {
|
|
4453
|
-
const n =
|
|
4778
|
+
const n = num8(value, flag);
|
|
4454
4779
|
if (n < min || n > max) {
|
|
4455
4780
|
throw new CliError("PARAM_INVALID", `--${flag} must be between ${min} and ${max}.`);
|
|
4456
4781
|
}
|
|
@@ -4523,12 +4848,12 @@ function registerHotelFiltersCommand(parent, deps) {
|
|
|
4523
4848
|
}
|
|
4524
4849
|
const body = {};
|
|
4525
4850
|
if (hasDestination) {
|
|
4526
|
-
body.destination_id =
|
|
4851
|
+
body.destination_id = need15(opts.destinationId, "destination-id");
|
|
4527
4852
|
} else {
|
|
4528
4853
|
body.lat = coord2(opts.lat, "lat", -90, 90);
|
|
4529
4854
|
body.lng = coord2(opts.lng, "lng", -180, 180);
|
|
4530
4855
|
}
|
|
4531
|
-
body.distance =
|
|
4856
|
+
body.distance = num8(opts.distance, "distance");
|
|
4532
4857
|
const result = await deps.apiClient.post(
|
|
4533
4858
|
"/hotel/filters",
|
|
4534
4859
|
{ type: "api-key", key: apiKey },
|
|
@@ -4548,7 +4873,7 @@ function registerHotelFiltersCommand(parent, deps) {
|
|
|
4548
4873
|
}
|
|
4549
4874
|
|
|
4550
4875
|
// src/hotel-redaug/list-cities.ts
|
|
4551
|
-
function
|
|
4876
|
+
function need16(value, flag) {
|
|
4552
4877
|
if (value === void 0 || value.trim() === "") {
|
|
4553
4878
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4554
4879
|
}
|
|
@@ -4581,7 +4906,7 @@ function registerHotelListCitiesCommand(parent, deps) {
|
|
|
4581
4906
|
message: "API Key:",
|
|
4582
4907
|
type: "password"
|
|
4583
4908
|
});
|
|
4584
|
-
const country =
|
|
4909
|
+
const country = need16(opts.country, "country");
|
|
4585
4910
|
const body = { country_code: country };
|
|
4586
4911
|
const result = await deps.apiClient.post(
|
|
4587
4912
|
"/hotel/cities",
|
|
@@ -4602,7 +4927,7 @@ function registerHotelListCitiesCommand(parent, deps) {
|
|
|
4602
4927
|
}
|
|
4603
4928
|
|
|
4604
4929
|
// src/hotel-redaug/hotel-detail.ts
|
|
4605
|
-
function
|
|
4930
|
+
function need17(value, flag) {
|
|
4606
4931
|
if (value === void 0 || value.trim() === "") {
|
|
4607
4932
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4608
4933
|
}
|
|
@@ -4749,7 +5074,7 @@ function registerHotelDetailCommand(parent, deps) {
|
|
|
4749
5074
|
message: "API Key:",
|
|
4750
5075
|
type: "password"
|
|
4751
5076
|
});
|
|
4752
|
-
const hotelId =
|
|
5077
|
+
const hotelId = need17(opts.hotelId, "hotel-id");
|
|
4753
5078
|
const rawWithImages = opts.withImages;
|
|
4754
5079
|
const withImages = rawWithImages !== "false" && rawWithImages !== false;
|
|
4755
5080
|
const settings = parseSettings(opts.settings);
|
|
@@ -4957,14 +5282,14 @@ function registerHotelSkillCommand(parent) {
|
|
|
4957
5282
|
}
|
|
4958
5283
|
|
|
4959
5284
|
// src/flight-flink/_helpers.ts
|
|
4960
|
-
function
|
|
5285
|
+
function need18(value, flag) {
|
|
4961
5286
|
if (value === void 0) {
|
|
4962
5287
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4963
5288
|
}
|
|
4964
5289
|
return value;
|
|
4965
5290
|
}
|
|
4966
|
-
function
|
|
4967
|
-
const n = Number(
|
|
5291
|
+
function num9(value, flag) {
|
|
5292
|
+
const n = Number(need18(value, flag));
|
|
4968
5293
|
if (!Number.isFinite(n)) {
|
|
4969
5294
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4970
5295
|
}
|
|
@@ -4999,7 +5324,7 @@ function registerFindAirportCommand(parent, deps) {
|
|
|
4999
5324
|
const opts = cmd.optsWithGlobals();
|
|
5000
5325
|
const format = resolveFormat(opts.format);
|
|
5001
5326
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5002
|
-
const keyword =
|
|
5327
|
+
const keyword = need18(opts.keyword, "keyword");
|
|
5003
5328
|
const spinner = format === "json" ? null : createSpinner("Resolving airports...");
|
|
5004
5329
|
const result = await deps.apiClient.post(
|
|
5005
5330
|
"/flight/find-airport",
|
|
@@ -5025,8 +5350,8 @@ function registerListAirportsCommand(parent, deps) {
|
|
|
5025
5350
|
const format = resolveFormat(opts.format);
|
|
5026
5351
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5027
5352
|
const body = {
|
|
5028
|
-
page:
|
|
5029
|
-
page_size:
|
|
5353
|
+
page: num9(opts.page, "page"),
|
|
5354
|
+
page_size: num9(opts.pageSize, "page-size")
|
|
5030
5355
|
};
|
|
5031
5356
|
if (opts.keyword !== void 0) body.keyword = opts.keyword;
|
|
5032
5357
|
const spinner = format === "json" ? null : createSpinner("Fetching airports...");
|
|
@@ -5050,8 +5375,8 @@ function registerListAirlinesCommand(parent, deps) {
|
|
|
5050
5375
|
const format = resolveFormat(opts.format);
|
|
5051
5376
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5052
5377
|
const body = {
|
|
5053
|
-
page:
|
|
5054
|
-
page_size:
|
|
5378
|
+
page: num9(opts.page, "page"),
|
|
5379
|
+
page_size: num9(opts.pageSize, "page-size")
|
|
5055
5380
|
};
|
|
5056
5381
|
if (opts.keyword !== void 0) body.keyword = opts.keyword;
|
|
5057
5382
|
const spinner = format === "json" ? null : createSpinner("Fetching airlines...");
|
|
@@ -5095,13 +5420,13 @@ function registerSearchCommand(parent, deps) {
|
|
|
5095
5420
|
const format = resolveFormat(opts.format);
|
|
5096
5421
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5097
5422
|
const body = {
|
|
5098
|
-
trip_type:
|
|
5099
|
-
journeys: jsonArray(
|
|
5423
|
+
trip_type: num9(opts.tripType, "trip-type"),
|
|
5424
|
+
journeys: jsonArray(need18(opts.journeys, "journeys"), "journeys"),
|
|
5100
5425
|
cabin_class: opts.cabinClass,
|
|
5101
|
-
adult_num:
|
|
5102
|
-
child_num:
|
|
5103
|
-
infant_num:
|
|
5104
|
-
transfer_number:
|
|
5426
|
+
adult_num: num9(opts.adultNum, "adult-num"),
|
|
5427
|
+
child_num: num9(opts.childNum, "child-num"),
|
|
5428
|
+
infant_num: num9(opts.infantNum, "infant-num"),
|
|
5429
|
+
transfer_number: num9(opts.transferNumber, "transfer-number")
|
|
5105
5430
|
};
|
|
5106
5431
|
if (opts.airline !== void 0) body.airline = opts.airline;
|
|
5107
5432
|
if (opts.journeyId !== void 0) {
|
|
@@ -5127,7 +5452,7 @@ function registerMoreOffersCommand(parent, deps) {
|
|
|
5127
5452
|
const opts = cmd.optsWithGlobals();
|
|
5128
5453
|
const format = resolveFormat(opts.format);
|
|
5129
5454
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5130
|
-
const productToken =
|
|
5455
|
+
const productToken = need18(opts.productToken, "product-token");
|
|
5131
5456
|
const spinner = format === "json" ? null : createSpinner("Fetching offers...");
|
|
5132
5457
|
const result = await deps.apiClient.post(
|
|
5133
5458
|
"/flight/more-offers",
|
|
@@ -5148,7 +5473,7 @@ function registerVerifyCommand(parent, deps) {
|
|
|
5148
5473
|
const opts = cmd.optsWithGlobals();
|
|
5149
5474
|
const format = resolveFormat(opts.format);
|
|
5150
5475
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5151
|
-
const productToken =
|
|
5476
|
+
const productToken = need18(opts.productToken, "product-token");
|
|
5152
5477
|
const spinner = format === "json" ? null : createSpinner("Verifying price...");
|
|
5153
5478
|
const result = await deps.apiClient.post(
|
|
5154
5479
|
"/flight/verify",
|
|
@@ -5170,7 +5495,7 @@ function registerVerifyCommand(parent, deps) {
|
|
|
5170
5495
|
}
|
|
5171
5496
|
|
|
5172
5497
|
// src/flight-flink/create-order.ts
|
|
5173
|
-
import { confirm as
|
|
5498
|
+
import { confirm as confirm7 } from "@inquirer/prompts";
|
|
5174
5499
|
function registerCreateOrderCommand(parent, deps) {
|
|
5175
5500
|
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("--passengers <json>", "JSON array of passengers (gender/id_type are strings)").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(
|
|
5176
5501
|
"--authorized-merchant-trans-id <id>",
|
|
@@ -5182,19 +5507,19 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
5182
5507
|
const format = resolveFormat(opts.format);
|
|
5183
5508
|
const isYes = Boolean(opts.yes);
|
|
5184
5509
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5185
|
-
const productToken =
|
|
5186
|
-
const totalAmount =
|
|
5187
|
-
const currency =
|
|
5510
|
+
const productToken = need18(opts.productToken, "product-token");
|
|
5511
|
+
const totalAmount = num9(opts.totalAmount, "total-amount");
|
|
5512
|
+
const currency = need18(opts.currency, "currency");
|
|
5188
5513
|
const body = {
|
|
5189
5514
|
product_token: productToken,
|
|
5190
5515
|
total_amount: totalAmount,
|
|
5191
5516
|
currency,
|
|
5192
|
-
trip_type:
|
|
5193
|
-
contact_name:
|
|
5194
|
-
contact_region:
|
|
5195
|
-
contact_phone:
|
|
5196
|
-
contact_email:
|
|
5197
|
-
passengers: jsonArray(
|
|
5517
|
+
trip_type: num9(opts.tripType, "trip-type"),
|
|
5518
|
+
contact_name: need18(opts.contactName, "contact-name"),
|
|
5519
|
+
contact_region: need18(opts.contactRegion, "contact-region"),
|
|
5520
|
+
contact_phone: need18(opts.contactPhone, "contact-phone"),
|
|
5521
|
+
contact_email: need18(opts.contactEmail, "contact-email"),
|
|
5522
|
+
passengers: jsonArray(need18(opts.passengers, "passengers"), "passengers")
|
|
5198
5523
|
};
|
|
5199
5524
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5200
5525
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
@@ -5204,7 +5529,7 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
5204
5529
|
const member = memberIdOf(opts);
|
|
5205
5530
|
if (member !== void 0) body.member_id = member;
|
|
5206
5531
|
if (!isYes) {
|
|
5207
|
-
const ok = await
|
|
5532
|
+
const ok = await confirm7({
|
|
5208
5533
|
message: `Create this flight order for ${totalAmount} ${currency}? This locks the fare but does NOT charge yet.`,
|
|
5209
5534
|
default: false
|
|
5210
5535
|
});
|
|
@@ -5243,18 +5568,21 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
5243
5568
|
}
|
|
5244
5569
|
|
|
5245
5570
|
// src/flight-flink/pay-order.ts
|
|
5246
|
-
import { confirm as
|
|
5571
|
+
import { confirm as confirm8 } from "@inquirer/prompts";
|
|
5247
5572
|
function registerPayOrderCommand(parent, deps) {
|
|
5248
|
-
const cmd = parent.command("pay-order").description("Settle a created order by --order-no (triggers ticketing)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-no <id>", "Our order reference from create-order").option("--
|
|
5573
|
+
const cmd = parent.command("pay-order").description("Settle a created order by --order-no (triggers ticketing)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-no <id>", "Our order reference from create-order").option("--payment-method-id <id>", "Optional bound-card id to charge (pay_per_call only)").option("--payment-token-id <id>", "Optional network-token id (unionpay/visa charge path)").option(
|
|
5574
|
+
"--authorized-merchant-trans-id <id>",
|
|
5575
|
+
"Resume a 3DS challenge: merchant trans id of an already-authorised preauth"
|
|
5576
|
+
).option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5249
5577
|
attachSchemaHelp(cmd, flightPayOrderSchema);
|
|
5250
5578
|
cmd.action(async () => {
|
|
5251
5579
|
const opts = cmd.optsWithGlobals();
|
|
5252
5580
|
const format = resolveFormat(opts.format);
|
|
5253
5581
|
const isYes = Boolean(opts.yes);
|
|
5254
5582
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5255
|
-
const orderNo =
|
|
5583
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5256
5584
|
if (!isYes) {
|
|
5257
|
-
const ok = await
|
|
5585
|
+
const ok = await confirm8({
|
|
5258
5586
|
message: `Pay and ticket order ${orderNo}? This settles the order and issues tickets.`,
|
|
5259
5587
|
default: false
|
|
5260
5588
|
});
|
|
@@ -5265,10 +5593,16 @@ function registerPayOrderCommand(parent, deps) {
|
|
|
5265
5593
|
commandPath: "flight-flink pay-order"
|
|
5266
5594
|
});
|
|
5267
5595
|
const spinner = format === "json" ? null : createSpinner("Paying flight order...");
|
|
5596
|
+
const body = {};
|
|
5597
|
+
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5598
|
+
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
5599
|
+
if (opts.authorizedMerchantTransId !== void 0) {
|
|
5600
|
+
body.authorized_merchant_trans_id = opts.authorizedMerchantTransId;
|
|
5601
|
+
}
|
|
5268
5602
|
const result = await deps.apiClient.post(
|
|
5269
5603
|
`/flight/${encodeURIComponent(orderNo)}/pay`,
|
|
5270
5604
|
{ type: "api-key", key: apiKey },
|
|
5271
|
-
|
|
5605
|
+
body,
|
|
5272
5606
|
{ "Idempotency-Key": idempotencyKey }
|
|
5273
5607
|
);
|
|
5274
5608
|
spinner?.stop();
|
|
@@ -5297,12 +5631,12 @@ function registerGetOrderCommand(parent, deps) {
|
|
|
5297
5631
|
const opts = cmd.optsWithGlobals();
|
|
5298
5632
|
const format = resolveFormat(opts.format);
|
|
5299
5633
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5300
|
-
const orderNo =
|
|
5634
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5301
5635
|
const path = `/flight/${encodeURIComponent(orderNo)}/status`;
|
|
5302
5636
|
const auth = { type: "api-key", key: apiKey };
|
|
5303
5637
|
if (opts.watch) {
|
|
5304
|
-
const interval =
|
|
5305
|
-
const timeoutMs =
|
|
5638
|
+
const interval = num9(opts.watchInterval, "watch-interval") * 1e3;
|
|
5639
|
+
const timeoutMs = num9(opts.watchTimeout, "watch-timeout") * 1e3;
|
|
5306
5640
|
const deadline = Date.now() + timeoutMs;
|
|
5307
5641
|
for (; ; ) {
|
|
5308
5642
|
const r = await deps.apiClient.get(path, auth);
|
|
@@ -5337,7 +5671,7 @@ function registerGetOrderCommand(parent, deps) {
|
|
|
5337
5671
|
}
|
|
5338
5672
|
|
|
5339
5673
|
// src/flight-flink/cancel-order.ts
|
|
5340
|
-
import { confirm as
|
|
5674
|
+
import { confirm as confirm9 } from "@inquirer/prompts";
|
|
5341
5675
|
function registerCancelOrderCommand(parent, deps) {
|
|
5342
5676
|
const cmd = parent.command("cancel-order").description("Cancel an un-ticketed flight order (with refund)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-no <id>", "Our order reference").option("--reason <text>", "Optional cancellation reason").option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5343
5677
|
attachSchemaHelp(cmd, flightCancelOrderSchema);
|
|
@@ -5346,9 +5680,9 @@ function registerCancelOrderCommand(parent, deps) {
|
|
|
5346
5680
|
const format = resolveFormat(opts.format);
|
|
5347
5681
|
const isYes = Boolean(opts.yes);
|
|
5348
5682
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5349
|
-
const orderNo =
|
|
5683
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5350
5684
|
if (!isYes) {
|
|
5351
|
-
const ok = await
|
|
5685
|
+
const ok = await confirm9({
|
|
5352
5686
|
message: `Cancel order ${orderNo}? This requests cancellation and a refund.`,
|
|
5353
5687
|
default: false
|
|
5354
5688
|
});
|
|
@@ -5393,8 +5727,8 @@ function registerListOrdersCommand2(parent, deps) {
|
|
|
5393
5727
|
if (opts.status !== void 0) params.set("status", opts.status);
|
|
5394
5728
|
const member = memberIdOf(opts);
|
|
5395
5729
|
if (member !== void 0) params.set("member_id", member);
|
|
5396
|
-
params.set("page", String(
|
|
5397
|
-
params.set("page_size", String(
|
|
5730
|
+
params.set("page", String(num9(opts.page, "page")));
|
|
5731
|
+
params.set("page_size", String(num9(opts.pageSize, "page-size")));
|
|
5398
5732
|
const spinner = format === "json" ? null : createSpinner("Fetching flight orders...");
|
|
5399
5733
|
const result = await deps.apiClient.get(
|
|
5400
5734
|
`/flight/orders?${params.toString()}`,
|
|
@@ -5422,10 +5756,10 @@ function registerChangeSearchCommand(parent, deps) {
|
|
|
5422
5756
|
const format = resolveFormat(opts.format);
|
|
5423
5757
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5424
5758
|
const body = {
|
|
5425
|
-
order_no:
|
|
5426
|
-
date:
|
|
5427
|
-
passenger:
|
|
5428
|
-
segment_id:
|
|
5759
|
+
order_no: need18(opts.orderNo, "order-no"),
|
|
5760
|
+
date: need18(opts.date, "date"),
|
|
5761
|
+
passenger: need18(opts.passenger, "passenger"),
|
|
5762
|
+
segment_id: need18(opts.segmentId, "segment-id"),
|
|
5429
5763
|
cabin_class: opts.cabinClass
|
|
5430
5764
|
};
|
|
5431
5765
|
const spinner = format === "json" ? null : createSpinner("Searching change options...");
|
|
@@ -5441,7 +5775,7 @@ function registerChangeSearchCommand(parent, deps) {
|
|
|
5441
5775
|
}
|
|
5442
5776
|
|
|
5443
5777
|
// src/flight-flink/change-apply.ts
|
|
5444
|
-
import { confirm as
|
|
5778
|
+
import { confirm as confirm10 } from "@inquirer/prompts";
|
|
5445
5779
|
function registerChangeApplyCommand(parent, deps) {
|
|
5446
5780
|
const cmd = parent.command("change-apply").description("Submit a change request (returns change_order_no, pending review)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-no <id>", "Our order reference").option("--passenger <code>", "passengerCode").option("--segment-id <ids>", "Comma-separated segment ids").option("--product-token <token>", "Change priceKey token").option("--contact-name <name>", "Contact name").option("--contact-region <code>", "Contact region").option("--contact-phone <phone>", "Contact phone").option("--contact-email <email>", "Contact email").option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5447
5781
|
attachSchemaHelp(cmd, flightChangeApplySchema);
|
|
@@ -5451,17 +5785,17 @@ function registerChangeApplyCommand(parent, deps) {
|
|
|
5451
5785
|
const isYes = Boolean(opts.yes);
|
|
5452
5786
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5453
5787
|
const body = {
|
|
5454
|
-
order_no:
|
|
5455
|
-
passenger:
|
|
5456
|
-
segment_id:
|
|
5457
|
-
product_token:
|
|
5458
|
-
contact_name:
|
|
5459
|
-
contact_region:
|
|
5460
|
-
contact_phone:
|
|
5461
|
-
contact_email:
|
|
5788
|
+
order_no: need18(opts.orderNo, "order-no"),
|
|
5789
|
+
passenger: need18(opts.passenger, "passenger"),
|
|
5790
|
+
segment_id: need18(opts.segmentId, "segment-id"),
|
|
5791
|
+
product_token: need18(opts.productToken, "product-token"),
|
|
5792
|
+
contact_name: need18(opts.contactName, "contact-name"),
|
|
5793
|
+
contact_region: need18(opts.contactRegion, "contact-region"),
|
|
5794
|
+
contact_phone: need18(opts.contactPhone, "contact-phone"),
|
|
5795
|
+
contact_email: need18(opts.contactEmail, "contact-email")
|
|
5462
5796
|
};
|
|
5463
5797
|
if (!isYes) {
|
|
5464
|
-
const ok = await
|
|
5798
|
+
const ok = await confirm10({
|
|
5465
5799
|
message: `Submit a change request for order ${body.order_no}?`,
|
|
5466
5800
|
default: false
|
|
5467
5801
|
});
|
|
@@ -5492,7 +5826,7 @@ function registerChangeDetailCommand(parent, deps) {
|
|
|
5492
5826
|
const opts = cmd.optsWithGlobals();
|
|
5493
5827
|
const format = resolveFormat(opts.format);
|
|
5494
5828
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5495
|
-
const changeOrderNo =
|
|
5829
|
+
const changeOrderNo = need18(opts.changeOrderNo, "change-order-no");
|
|
5496
5830
|
const spinner = format === "json" ? null : createSpinner("Fetching change detail...");
|
|
5497
5831
|
const result = await deps.apiClient.get(
|
|
5498
5832
|
`/flight/change/${encodeURIComponent(changeOrderNo)}`,
|
|
@@ -5505,7 +5839,7 @@ function registerChangeDetailCommand(parent, deps) {
|
|
|
5505
5839
|
}
|
|
5506
5840
|
|
|
5507
5841
|
// src/flight-flink/change-cancel.ts
|
|
5508
|
-
import { confirm as
|
|
5842
|
+
import { confirm as confirm11 } from "@inquirer/prompts";
|
|
5509
5843
|
function registerChangeCancelCommand(parent, deps) {
|
|
5510
5844
|
const cmd = parent.command("change-cancel").description("Cancel a change request (immediate terminal)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--change-order-no <id>", "Change order number").option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5511
5845
|
attachSchemaHelp(cmd, flightChangeCancelSchema);
|
|
@@ -5514,9 +5848,9 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5514
5848
|
const format = resolveFormat(opts.format);
|
|
5515
5849
|
const isYes = Boolean(opts.yes);
|
|
5516
5850
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5517
|
-
const changeOrderNo =
|
|
5851
|
+
const changeOrderNo = need18(opts.changeOrderNo, "change-order-no");
|
|
5518
5852
|
if (!isYes) {
|
|
5519
|
-
const ok = await
|
|
5853
|
+
const ok = await confirm11({ message: `Cancel change request ${changeOrderNo}?`, default: false });
|
|
5520
5854
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Change cancellation aborted by user.");
|
|
5521
5855
|
}
|
|
5522
5856
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5537,7 +5871,7 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5537
5871
|
}
|
|
5538
5872
|
|
|
5539
5873
|
// src/flight-flink/change-pay.ts
|
|
5540
|
-
import { confirm as
|
|
5874
|
+
import { confirm as confirm12 } from "@inquirer/prompts";
|
|
5541
5875
|
function registerChangePayCommand(parent, deps) {
|
|
5542
5876
|
const cmd = parent.command("change-pay").description("Pay a change request fee (like a normal order) and trigger change ticketing").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--change-order-no <id>", "Change order number").option("--order-no <id>", "Original order reference (ownership check)").option("--amount <amount>", "Change fee total in decimal units (change-detail price_total)").option("--currency <currency>", "ISO 4217 currency code", "USD").option("--payment-method-id <id>", "Optional bound-card id (EVO path)").option("--payment-token-id <id>", "Optional UPI network-token id (unionpay charge path)").option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5543
5877
|
attachSchemaHelp(cmd, flightChangePaySchema);
|
|
@@ -5546,10 +5880,10 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5546
5880
|
const format = resolveFormat(opts.format);
|
|
5547
5881
|
const isYes = Boolean(opts.yes);
|
|
5548
5882
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5549
|
-
const changeOrderNo =
|
|
5550
|
-
const orderNo =
|
|
5551
|
-
const amount =
|
|
5552
|
-
const currency =
|
|
5883
|
+
const changeOrderNo = need18(opts.changeOrderNo, "change-order-no");
|
|
5884
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5885
|
+
const amount = num9(opts.amount, "amount");
|
|
5886
|
+
const currency = need18(opts.currency, "currency");
|
|
5553
5887
|
const body = {
|
|
5554
5888
|
order_no: orderNo,
|
|
5555
5889
|
amount,
|
|
@@ -5558,7 +5892,7 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5558
5892
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5559
5893
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
5560
5894
|
if (!isYes) {
|
|
5561
|
-
const ok = await
|
|
5895
|
+
const ok = await confirm12({
|
|
5562
5896
|
message: `Pay change fee ${amount} ${currency} for change order ${changeOrderNo}? This charges the customer and triggers change ticketing.`,
|
|
5563
5897
|
default: false
|
|
5564
5898
|
});
|
|
@@ -5594,7 +5928,7 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5594
5928
|
}
|
|
5595
5929
|
|
|
5596
5930
|
// src/flight-flink/refund-apply.ts
|
|
5597
|
-
import { confirm as
|
|
5931
|
+
import { confirm as confirm13 } from "@inquirer/prompts";
|
|
5598
5932
|
function registerRefundApplyCommand(parent, deps) {
|
|
5599
5933
|
const cmd = parent.command("refund-apply").description("Submit a refund request (returns refund_order_no, pending review)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-no <id>", "Our order reference").option("--passenger <code>", "passengerCode").option("--segment-id <ids>", "Comma-separated segment ids").option("--reason-type <n>", "Refund reason type code").option("--reason <text>", "Free-text reason").option("--contact-name <name>", "Contact name").option("--contact-region <code>", "Contact region").option("--contact-phone <phone>", "Contact phone").option("--contact-email <email>", "Contact email").option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5600
5934
|
attachSchemaHelp(cmd, flightRefundApplySchema);
|
|
@@ -5604,18 +5938,18 @@ function registerRefundApplyCommand(parent, deps) {
|
|
|
5604
5938
|
const isYes = Boolean(opts.yes);
|
|
5605
5939
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5606
5940
|
const body = {
|
|
5607
|
-
order_no:
|
|
5608
|
-
passenger:
|
|
5609
|
-
segment_id:
|
|
5610
|
-
reason_type:
|
|
5611
|
-
contact_name:
|
|
5612
|
-
contact_region:
|
|
5613
|
-
contact_phone:
|
|
5614
|
-
contact_email:
|
|
5941
|
+
order_no: need18(opts.orderNo, "order-no"),
|
|
5942
|
+
passenger: need18(opts.passenger, "passenger"),
|
|
5943
|
+
segment_id: need18(opts.segmentId, "segment-id"),
|
|
5944
|
+
reason_type: num9(opts.reasonType, "reason-type"),
|
|
5945
|
+
contact_name: need18(opts.contactName, "contact-name"),
|
|
5946
|
+
contact_region: need18(opts.contactRegion, "contact-region"),
|
|
5947
|
+
contact_phone: need18(opts.contactPhone, "contact-phone"),
|
|
5948
|
+
contact_email: need18(opts.contactEmail, "contact-email")
|
|
5615
5949
|
};
|
|
5616
5950
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
5617
5951
|
if (!isYes) {
|
|
5618
|
-
const ok = await
|
|
5952
|
+
const ok = await confirm13({
|
|
5619
5953
|
message: `Submit a refund request for order ${body.order_no}?`,
|
|
5620
5954
|
default: false
|
|
5621
5955
|
});
|
|
@@ -5646,7 +5980,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
5646
5980
|
const opts = cmd.optsWithGlobals();
|
|
5647
5981
|
const format = resolveFormat(opts.format);
|
|
5648
5982
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5649
|
-
const refundOrderNo =
|
|
5983
|
+
const refundOrderNo = need18(opts.refundOrderNo, "refund-order-no");
|
|
5650
5984
|
const spinner = format === "json" ? null : createSpinner("Fetching refund detail...");
|
|
5651
5985
|
const result = await deps.apiClient.get(
|
|
5652
5986
|
`/flight/refund/${encodeURIComponent(refundOrderNo)}`,
|
|
@@ -5659,7 +5993,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
5659
5993
|
}
|
|
5660
5994
|
|
|
5661
5995
|
// src/flight-flink/refund-confirm.ts
|
|
5662
|
-
import { confirm as
|
|
5996
|
+
import { confirm as confirm14 } from "@inquirer/prompts";
|
|
5663
5997
|
function registerRefundConfirmCommand(parent, deps) {
|
|
5664
5998
|
const cmd = parent.command("refund-confirm").description('Confirm ("1") or cancel ("2") a refund').option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--refund-order-no <id>", "Refund order number").option("--confirm <flag>", '"1" confirm / "2" cancel').option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5665
5999
|
attachSchemaHelp(cmd, flightRefundConfirmSchema);
|
|
@@ -5668,14 +6002,14 @@ function registerRefundConfirmCommand(parent, deps) {
|
|
|
5668
6002
|
const format = resolveFormat(opts.format);
|
|
5669
6003
|
const isYes = Boolean(opts.yes);
|
|
5670
6004
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5671
|
-
const refundOrderNo =
|
|
5672
|
-
const confirmFlag =
|
|
6005
|
+
const refundOrderNo = need18(opts.refundOrderNo, "refund-order-no");
|
|
6006
|
+
const confirmFlag = need18(opts.confirm, "confirm");
|
|
5673
6007
|
if (confirmFlag !== "1" && confirmFlag !== "2") {
|
|
5674
6008
|
throw new CliError("PARAM_INVALID", '--confirm must be "1" (confirm) or "2" (cancel).');
|
|
5675
6009
|
}
|
|
5676
6010
|
if (!isYes) {
|
|
5677
6011
|
const action = confirmFlag === "1" ? "confirm" : "cancel";
|
|
5678
|
-
const ok = await
|
|
6012
|
+
const ok = await confirm14({ message: `${action} refund ${refundOrderNo}?`, default: false });
|
|
5679
6013
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Refund confirmation aborted by user.");
|
|
5680
6014
|
}
|
|
5681
6015
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5805,13 +6139,16 @@ async function main() {
|
|
|
5805
6139
|
process.env.AGENZO_FORMAT = resolveFormat(flag);
|
|
5806
6140
|
});
|
|
5807
6141
|
const rideCmd = program.command("ride-elife").description(
|
|
5808
|
-
`Ride ordering (eLife) \u2014 quote a fare, book it, poll status, and cancel.
|
|
6142
|
+
`Ride ordering (eLife) \u2014 quote a fare, book it, poll status, modify it, and cancel.
|
|
5809
6143
|
|
|
5810
6144
|
Workflow (typical order):
|
|
5811
6145
|
1. quote Get fare quotes between two points \u2192 vehicle_classes[] each with a quote_id
|
|
5812
6146
|
2. book Book one vehicle_class using its quote_id \u2192 ride_id (write; needs --idempotency-key)
|
|
5813
6147
|
3. get Poll ride status by --order-id=<ride_id> until terminal (or use --watch for NDJSON)
|
|
5814
6148
|
4. cancel (optional) Cancel a ride by --order-id (write; may incur a fee)
|
|
6149
|
+
update (optional) Modify trip details and/or passenger of a booked ride
|
|
6150
|
+
(write; needs --idempotency-key; the fare may change)
|
|
6151
|
+
trip-status (optional) Status + driver location points of ONE leg of a multi-leg ride
|
|
5815
6152
|
list-orders (standalone) List the developer's previous ride orders
|
|
5816
6153
|
|
|
5817
6154
|
Key notes:
|
|
@@ -5826,13 +6163,19 @@ Key notes:
|
|
|
5826
6163
|
\u2022 All amounts are DECIMAL currency units (e.g. 42.50 = $42.50), never minor units (cents).
|
|
5827
6164
|
\u2022 Billing mode is decided server-side: pay_per_call needs a PAID --payment-order-id (from
|
|
5828
6165
|
payment-cli); monthly_settlement forbids it (settled against the developer's account).
|
|
5829
|
-
\u2022 Write verbs (book / cancel) require --idempotency-key; reuse the SAME key when
|
|
5830
|
-
same intent
|
|
6166
|
+
\u2022 Write verbs (book / cancel / update) require --idempotency-key; reuse the SAME key when
|
|
6167
|
+
retrying the same intent.
|
|
6168
|
+
\u2022 update changes ONLY the fields you pass. Trip-side and passenger-side changes are two separate
|
|
6169
|
+
upstream calls with no transaction: the response reports ride_updated / passenger_updated, and a
|
|
6170
|
+
partial application returns UPSTREAM_ERROR with data.partial_update \u2014 re-issue update for the
|
|
6171
|
+
failed side only.`
|
|
5831
6172
|
);
|
|
5832
6173
|
registerQuoteCommand(rideCmd, deps);
|
|
5833
6174
|
registerBookCommand(rideCmd, deps);
|
|
5834
6175
|
registerRideGetCommand(rideCmd, deps);
|
|
5835
6176
|
registerCancelCommand(rideCmd, deps);
|
|
6177
|
+
registerRideUpdateCommand(rideCmd, deps);
|
|
6178
|
+
registerRideTripStatusCommand(rideCmd, deps);
|
|
5836
6179
|
registerListOrdersCommand(rideCmd, deps);
|
|
5837
6180
|
const servicesCmd = program.command("services").description("Merchant service discovery");
|
|
5838
6181
|
registerServicesListCommand(servicesCmd, { discoveryClient, program });
|