@agenzo/merchant-cli 0.8.11 → 0.8.12
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 -155
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1182,6 +1182,91 @@ var cancelSchema = {
|
|
|
1182
1182
|
PARAM_IDEMPOTENCY_KEY_REQUIRED: "Supply --idempotency-key (1-128 chars [A-Za-z0-9_-]); the CLI never generates one under --yes."
|
|
1183
1183
|
}
|
|
1184
1184
|
};
|
|
1185
|
+
var rideUpdateSchema = {
|
|
1186
|
+
cli: CLI_NAME,
|
|
1187
|
+
noun: NOUN,
|
|
1188
|
+
verb: "update",
|
|
1189
|
+
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",
|
|
1190
|
+
flags: {
|
|
1191
|
+
"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" },
|
|
1192
|
+
"idempotency-key": {
|
|
1193
|
+
type: "string",
|
|
1194
|
+
required: true,
|
|
1195
|
+
description: "Unique key (1-128 chars [A-Za-z0-9_-]) forwarded verbatim as the Idempotency-Key header; never auto-generated"
|
|
1196
|
+
},
|
|
1197
|
+
"pickup-lat": { type: "float", required: false, description: "New pickup latitude", constraints: "-90 to 90" },
|
|
1198
|
+
"pickup-lng": { type: "float", required: false, description: "New pickup longitude", constraints: "-180 to 180" },
|
|
1199
|
+
"pickup-name": { type: "string", required: false, description: "New pickup location name" },
|
|
1200
|
+
"dropoff-lat": { type: "float", required: false, description: "New dropoff latitude", constraints: "-90 to 90" },
|
|
1201
|
+
"dropoff-lng": { type: "float", required: false, description: "New dropoff longitude", constraints: "-180 to 180" },
|
|
1202
|
+
"dropoff-name": { type: "string", required: false, description: "New dropoff location name" },
|
|
1203
|
+
"pickup-time": { type: "int|string", required: false, description: "New pickup time: epoch seconds or 'now'" },
|
|
1204
|
+
"welcome-sign": { type: "string", required: false, description: "New welcome sign text (meet & greet)" },
|
|
1205
|
+
"arrival-flight-no": { type: "string", required: false, description: "New arrival flight number" },
|
|
1206
|
+
"arrival-airline": { type: "string", required: false, description: "New arrival airline name" },
|
|
1207
|
+
"departure-flight-no": { type: "string", required: false, description: "New departure flight number" },
|
|
1208
|
+
"departure-airline": { type: "string", required: false, description: "New departure airline name" },
|
|
1209
|
+
"service-area-id": { type: "string", required: false, description: "Service area id, when the upstream requires re-scoping the ride" },
|
|
1210
|
+
"passenger-name": { type: "string", required: false, description: "New passenger full name (passing any passenger-* flag triggers a passenger update)" },
|
|
1211
|
+
"passenger-phone": { type: "string", required: false, description: "New passenger phone in E.164 format (e.g. +14155551234)" },
|
|
1212
|
+
"passenger-email": { type: "string", required: false, description: "New passenger email" },
|
|
1213
|
+
"luggage-count": { type: "int", required: false, description: "New luggage count" }
|
|
1214
|
+
},
|
|
1215
|
+
response: {
|
|
1216
|
+
ride_id: { type: "string|int", description: "Modified ride id" },
|
|
1217
|
+
status: { type: "string", description: "Result status, 'updated' when the modification was applied" },
|
|
1218
|
+
ride_updated: { type: "bool", description: "true when trip-side fields were sent upstream" },
|
|
1219
|
+
passenger_updated: { type: "bool", description: "true when passenger fields were sent upstream" }
|
|
1220
|
+
},
|
|
1221
|
+
example: {
|
|
1222
|
+
command: "agenzo-merchant-cli ride-elife update --order-id 4112961 --pickup-time 1780000000 --idempotency-key update-789",
|
|
1223
|
+
output_summary: "Returns which sides were applied (ride_updated / passenger_updated)."
|
|
1224
|
+
},
|
|
1225
|
+
error_recovery: {
|
|
1226
|
+
PARAM_INVALID: "No modifiable field was supplied. Pass at least one trip field or one passenger-* flag.",
|
|
1227
|
+
RIDE_NOT_FOUND: "The ride does not exist or belongs to another developer. Verify --order-id is the ride_id from book.",
|
|
1228
|
+
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.",
|
|
1229
|
+
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`.",
|
|
1230
|
+
PARAM_IDEMPOTENCY_KEY_REQUIRED: "Supply --idempotency-key (1-128 chars [A-Za-z0-9_-]); the CLI never generates one under --yes."
|
|
1231
|
+
}
|
|
1232
|
+
};
|
|
1233
|
+
var rideTripStatusSchema = {
|
|
1234
|
+
cli: CLI_NAME,
|
|
1235
|
+
noun: NOUN,
|
|
1236
|
+
verb: "trip-status",
|
|
1237
|
+
description: "Query the status and driver location points of a single leg of a multi-leg ride",
|
|
1238
|
+
flags: {
|
|
1239
|
+
"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" },
|
|
1240
|
+
"trip-no": { type: "int", required: false, default: 1, description: "1-based leg index; defaults to the first leg" }
|
|
1241
|
+
},
|
|
1242
|
+
response: {
|
|
1243
|
+
ride_id: { type: "string|int", description: "Ride identifier" },
|
|
1244
|
+
trip_no: { type: "int", description: "Leg number this status refers to" },
|
|
1245
|
+
status: { type: "string", description: "Leg status, same vocabulary as `ride-elife get`" },
|
|
1246
|
+
points: {
|
|
1247
|
+
type: "array|null",
|
|
1248
|
+
description: "Driver location points for this leg",
|
|
1249
|
+
items: { lat: { type: "float" }, lng: { type: "float" }, utc_timestamp: { type: "int" } }
|
|
1250
|
+
}
|
|
1251
|
+
},
|
|
1252
|
+
example: {
|
|
1253
|
+
command: "agenzo-merchant-cli ride-elife trip-status --order-id 4112961 --trip-no 2",
|
|
1254
|
+
output_summary: "Returns the leg status plus its driver location points."
|
|
1255
|
+
},
|
|
1256
|
+
polling: {
|
|
1257
|
+
recommended_interval_seconds: DEFAULT_WATCH_INTERVAL_SECONDS,
|
|
1258
|
+
terminal_statuses: [...TERMINAL_STATUSES],
|
|
1259
|
+
in_progress_statuses: ["Pending", "Accepted", "On my way", "Waiting", "On board"],
|
|
1260
|
+
field_availability: {
|
|
1261
|
+
points: "Populated only after the driver starts moving on this leg; empty or null before that."
|
|
1262
|
+
}
|
|
1263
|
+
},
|
|
1264
|
+
error_recovery: {
|
|
1265
|
+
RIDE_NOT_FOUND: "The ride or the requested leg does not exist. Confirm the ride has multiple legs via `ride-elife get` first.",
|
|
1266
|
+
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`.",
|
|
1267
|
+
BOOKING_FAILED: "Transient upstream error. Retry once after 5s, or fall back to `ride-elife get` for whole-ride status."
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1185
1270
|
var listOrdersSchema = {
|
|
1186
1271
|
cli: CLI_NAME,
|
|
1187
1272
|
noun: NOUN,
|
|
@@ -2105,12 +2190,15 @@ var flightCreateOrderSchema = flightSchema(
|
|
|
2105
2190
|
);
|
|
2106
2191
|
var flightPayOrderSchema = flightSchema(
|
|
2107
2192
|
"pay-order",
|
|
2108
|
-
"
|
|
2193
|
+
"Charge the order and trigger upstream ticketing. AWAITING_PAYMENT \u2192 PAID. Funds move HERE, not in create-order.",
|
|
2109
2194
|
{
|
|
2110
2195
|
"order-no": { type: "string", required: true, description: "Our order reference from create-order." },
|
|
2196
|
+
"payment-method-id": { type: "string", required: false, description: "Optional bound-card id to charge (pay_per_call only; omit to use the default card)." },
|
|
2197
|
+
"payment-token-id": { type: "string", required: false, description: "Optional network-token id; settles via direct charge instead of EVO preauth." },
|
|
2198
|
+
"authorized-merchant-trans-id": { type: "string", required: false, description: "Resume a 3DS challenge with an already-authorised preauth trans id." },
|
|
2111
2199
|
"idempotency-key": { type: "string", required: true, description: "Forwarded verbatim as the Idempotency-Key header." }
|
|
2112
2200
|
},
|
|
2113
|
-
{ order_no: { type: "string", description: "Our order reference." }, status: { type: "string", description: "PAID on success." } },
|
|
2201
|
+
{ order_no: { type: "string", description: "Our order reference." }, status: { type: "string", description: "PAID on success; AUTHENTICATION_REQUIRED when the card needs 3DS." } },
|
|
2114
2202
|
{ 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
2203
|
);
|
|
2116
2204
|
var flightGetOrderSchema = flightSchema(
|
|
@@ -2730,6 +2818,225 @@ function registerCancelCommand(parent, deps) {
|
|
|
2730
2818
|
});
|
|
2731
2819
|
}
|
|
2732
2820
|
|
|
2821
|
+
// src/ride-elife/update.ts
|
|
2822
|
+
import { confirm as confirm3 } from "@inquirer/prompts";
|
|
2823
|
+
function need5(value, flag) {
|
|
2824
|
+
if (value === void 0) {
|
|
2825
|
+
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
2826
|
+
}
|
|
2827
|
+
return value;
|
|
2828
|
+
}
|
|
2829
|
+
function num3(value, flag) {
|
|
2830
|
+
if (value === void 0) return void 0;
|
|
2831
|
+
const parsed = Number(value);
|
|
2832
|
+
if (!Number.isFinite(parsed)) {
|
|
2833
|
+
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
2834
|
+
}
|
|
2835
|
+
return parsed;
|
|
2836
|
+
}
|
|
2837
|
+
function int(value, flag) {
|
|
2838
|
+
const parsed = num3(value, flag);
|
|
2839
|
+
if (parsed === void 0) return void 0;
|
|
2840
|
+
if (!Number.isInteger(parsed)) {
|
|
2841
|
+
throw new CliError("PARAM_INVALID", `--${flag} must be an integer.`);
|
|
2842
|
+
}
|
|
2843
|
+
return parsed;
|
|
2844
|
+
}
|
|
2845
|
+
function pickupTime(value) {
|
|
2846
|
+
if (value === void 0) return void 0;
|
|
2847
|
+
if (value === "now") return "now";
|
|
2848
|
+
const parsed = Number(value);
|
|
2849
|
+
if (!Number.isInteger(parsed)) {
|
|
2850
|
+
throw new CliError("PARAM_INVALID", "--pickup-time must be epoch seconds or 'now'.");
|
|
2851
|
+
}
|
|
2852
|
+
return parsed;
|
|
2853
|
+
}
|
|
2854
|
+
function location(lat, lng, name, side) {
|
|
2855
|
+
if (lat === void 0 && lng === void 0 && name === void 0) return void 0;
|
|
2856
|
+
if (lat === void 0 || lng === void 0 || name === void 0) {
|
|
2857
|
+
throw new CliError(
|
|
2858
|
+
"PARAM_INVALID",
|
|
2859
|
+
`--${side}-lat, --${side}-lng and --${side}-name must be passed together.`
|
|
2860
|
+
);
|
|
2861
|
+
}
|
|
2862
|
+
return {
|
|
2863
|
+
lat: num3(lat, `${side}-lat`),
|
|
2864
|
+
lng: num3(lng, `${side}-lng`),
|
|
2865
|
+
name
|
|
2866
|
+
};
|
|
2867
|
+
}
|
|
2868
|
+
function formatUpdate(data) {
|
|
2869
|
+
return Formatter.keyValue([
|
|
2870
|
+
["Ride ID", String(data.ride_id ?? "-")],
|
|
2871
|
+
["Status", String(data.status ?? "-")],
|
|
2872
|
+
["Trip details updated", data.ride_updated ? "yes" : "no"],
|
|
2873
|
+
["Passenger updated", data.passenger_updated ? "yes" : "no"]
|
|
2874
|
+
]);
|
|
2875
|
+
}
|
|
2876
|
+
function registerRideUpdateCommand(parent, deps) {
|
|
2877
|
+
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(
|
|
2878
|
+
"--idempotency-key <key>",
|
|
2879
|
+
"Idempotency key forwarded verbatim as the Idempotency-Key header"
|
|
2880
|
+
).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");
|
|
2881
|
+
attachSchemaHelp(cmd, rideUpdateSchema);
|
|
2882
|
+
cmd.action(async () => {
|
|
2883
|
+
const opts = cmd.optsWithGlobals();
|
|
2884
|
+
const format = resolveFormat(opts.format);
|
|
2885
|
+
const isYes = Boolean(opts.yes);
|
|
2886
|
+
const apiKey = await PromptEngine.resolveInput(opts.apiKey, {
|
|
2887
|
+
message: "API Key:",
|
|
2888
|
+
type: "password"
|
|
2889
|
+
});
|
|
2890
|
+
const orderId = need5(opts.orderId, "order-id");
|
|
2891
|
+
const mgTouched = process.argv.some(
|
|
2892
|
+
(a) => a === "--meet-and-greet" || a === "--no-meet-and-greet"
|
|
2893
|
+
);
|
|
2894
|
+
const body = {};
|
|
2895
|
+
const set = (key, value) => {
|
|
2896
|
+
if (value !== void 0) body[key] = value;
|
|
2897
|
+
};
|
|
2898
|
+
set("quote_id", opts.quoteId);
|
|
2899
|
+
set("vehicle_class", opts.vehicleClass);
|
|
2900
|
+
set("price_amount", num3(opts.priceAmount, "price-amount"));
|
|
2901
|
+
set("price_currency", opts.priceCurrency);
|
|
2902
|
+
set(
|
|
2903
|
+
"pickup",
|
|
2904
|
+
location(
|
|
2905
|
+
opts.pickupLat,
|
|
2906
|
+
opts.pickupLng,
|
|
2907
|
+
opts.pickupName,
|
|
2908
|
+
"pickup"
|
|
2909
|
+
)
|
|
2910
|
+
);
|
|
2911
|
+
set(
|
|
2912
|
+
"dropoff",
|
|
2913
|
+
location(
|
|
2914
|
+
opts.dropoffLat,
|
|
2915
|
+
opts.dropoffLng,
|
|
2916
|
+
opts.dropoffName,
|
|
2917
|
+
"dropoff"
|
|
2918
|
+
)
|
|
2919
|
+
);
|
|
2920
|
+
set("pickup_time", pickupTime(opts.pickupTime));
|
|
2921
|
+
if (mgTouched) set("meet_and_greet", Boolean(opts.meetAndGreet));
|
|
2922
|
+
set("welcome_sign", opts.welcomeSign);
|
|
2923
|
+
if (opts.arrivalFlightNo !== void 0 || opts.arrivalAirline !== void 0) {
|
|
2924
|
+
set("arrival_flight", {
|
|
2925
|
+
flight_no: opts.arrivalFlightNo,
|
|
2926
|
+
airline: opts.arrivalAirline
|
|
2927
|
+
});
|
|
2928
|
+
}
|
|
2929
|
+
if (opts.departureFlightNo !== void 0 || opts.departureAirline !== void 0) {
|
|
2930
|
+
set("departure_flight", {
|
|
2931
|
+
flight_no: opts.departureFlightNo,
|
|
2932
|
+
airline: opts.departureAirline
|
|
2933
|
+
});
|
|
2934
|
+
}
|
|
2935
|
+
set("service_area_id", opts.serviceAreaId);
|
|
2936
|
+
set("passenger_name", opts.passengerName);
|
|
2937
|
+
set("passenger_phone", opts.passengerPhone);
|
|
2938
|
+
set("passenger_email", opts.passengerEmail);
|
|
2939
|
+
set("luggage_count", int(opts.luggageCount, "luggage-count"));
|
|
2940
|
+
if (Object.keys(body).length === 0) {
|
|
2941
|
+
throw new CliError(
|
|
2942
|
+
"PARAM_INVALID",
|
|
2943
|
+
"Nothing to update. Pass at least one trip field or one passenger-* flag."
|
|
2944
|
+
);
|
|
2945
|
+
}
|
|
2946
|
+
if (!isYes) {
|
|
2947
|
+
const confirmed = await confirm3({
|
|
2948
|
+
message: `Apply ${Object.keys(body).length} change(s) to ride ${orderId}? The fare may change.`,
|
|
2949
|
+
default: false
|
|
2950
|
+
});
|
|
2951
|
+
if (!confirmed) {
|
|
2952
|
+
throw new CliError("CLIENT_ABORTED", "Update aborted by user.");
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
2956
|
+
yes: isYes,
|
|
2957
|
+
commandPath: "ride-elife update"
|
|
2958
|
+
});
|
|
2959
|
+
const spinner = format === "json" ? null : createSpinner("Updating ride...");
|
|
2960
|
+
const result = await deps.apiClient.post(
|
|
2961
|
+
`/ride/${encodeURIComponent(orderId)}/update`,
|
|
2962
|
+
{ type: "api-key", key: apiKey },
|
|
2963
|
+
body,
|
|
2964
|
+
{ "Idempotency-Key": idempotencyKey }
|
|
2965
|
+
);
|
|
2966
|
+
spinner?.stop();
|
|
2967
|
+
if (!result.success) {
|
|
2968
|
+
throw CliError.fromApi(result, { auth: "api-key" });
|
|
2969
|
+
}
|
|
2970
|
+
const data = result.data;
|
|
2971
|
+
const configManager = new ConfigManager();
|
|
2972
|
+
const commandResult = {
|
|
2973
|
+
data,
|
|
2974
|
+
text: () => formatUpdate(data)
|
|
2975
|
+
};
|
|
2976
|
+
await renderWithContext(commandResult, { format }, configManager);
|
|
2977
|
+
});
|
|
2978
|
+
}
|
|
2979
|
+
|
|
2980
|
+
// src/ride-elife/trip-status.ts
|
|
2981
|
+
function need6(value, flag) {
|
|
2982
|
+
if (value === void 0) {
|
|
2983
|
+
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
2984
|
+
}
|
|
2985
|
+
return value;
|
|
2986
|
+
}
|
|
2987
|
+
function tripNo(value) {
|
|
2988
|
+
if (value === void 0) return 1;
|
|
2989
|
+
const parsed = Number(value);
|
|
2990
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
2991
|
+
throw new CliError("PARAM_INVALID", "--trip-no must be an integer >= 1.");
|
|
2992
|
+
}
|
|
2993
|
+
return parsed;
|
|
2994
|
+
}
|
|
2995
|
+
function formatTripStatus(data) {
|
|
2996
|
+
const lines = [
|
|
2997
|
+
["Ride ID", String(data.ride_id ?? "-")],
|
|
2998
|
+
["Trip no", String(data.trip_no ?? "-")],
|
|
2999
|
+
["Status", String(data.status ?? "-")]
|
|
3000
|
+
];
|
|
3001
|
+
const points = data.points ?? [];
|
|
3002
|
+
lines.push(["Location points", String(points.length)]);
|
|
3003
|
+
const latest = points[points.length - 1];
|
|
3004
|
+
if (latest) {
|
|
3005
|
+
lines.push(["Latest position", `${latest.lat}, ${latest.lng} @ ${latest.utc_timestamp}`]);
|
|
3006
|
+
}
|
|
3007
|
+
return Formatter.keyValue(lines);
|
|
3008
|
+
}
|
|
3009
|
+
function registerRideTripStatusCommand(parent, deps) {
|
|
3010
|
+
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)");
|
|
3011
|
+
attachSchemaHelp(cmd, rideTripStatusSchema);
|
|
3012
|
+
cmd.action(async () => {
|
|
3013
|
+
const opts = cmd.optsWithGlobals();
|
|
3014
|
+
const format = resolveFormat(opts.format);
|
|
3015
|
+
const apiKey = await PromptEngine.resolveInput(opts.apiKey, {
|
|
3016
|
+
message: "API Key:",
|
|
3017
|
+
type: "password"
|
|
3018
|
+
});
|
|
3019
|
+
const orderId = need6(opts.orderId, "order-id");
|
|
3020
|
+
const leg = tripNo(opts.tripNo);
|
|
3021
|
+
const spinner = format === "json" ? null : createSpinner("Fetching trip status...");
|
|
3022
|
+
const result = await deps.apiClient.get(
|
|
3023
|
+
`/ride/${encodeURIComponent(orderId)}/trips/${leg}`,
|
|
3024
|
+
{ type: "api-key", key: apiKey }
|
|
3025
|
+
);
|
|
3026
|
+
spinner?.stop();
|
|
3027
|
+
if (!result.success) {
|
|
3028
|
+
throw CliError.fromApi(result, { auth: "api-key" });
|
|
3029
|
+
}
|
|
3030
|
+
const data = result.data;
|
|
3031
|
+
const configManager = new ConfigManager();
|
|
3032
|
+
const commandResult = {
|
|
3033
|
+
data,
|
|
3034
|
+
text: () => formatTripStatus(data)
|
|
3035
|
+
};
|
|
3036
|
+
await renderWithContext(commandResult, { format }, configManager);
|
|
3037
|
+
});
|
|
3038
|
+
}
|
|
3039
|
+
|
|
2733
3040
|
// src/ride-elife/list-orders.ts
|
|
2734
3041
|
var DEFAULT_PAGE = "1";
|
|
2735
3042
|
var DEFAULT_PAGE_SIZE = "20";
|
|
@@ -2814,15 +3121,24 @@ var SERVICE_REGISTRY = [
|
|
|
2814
3121
|
version: "1.0.0",
|
|
2815
3122
|
provider: "elife",
|
|
2816
3123
|
cli_noun: "ride-elife",
|
|
2817
|
-
verbs: ["quote", "book", "get", "cancel", "list-orders"],
|
|
3124
|
+
verbs: ["quote", "book", "get", "cancel", "update", "trip-status", "list-orders"],
|
|
2818
3125
|
verb_descriptions: {
|
|
2819
3126
|
quote: "Request fare quotes for a ride between two points.",
|
|
2820
3127
|
book: "Book a ride using a quote_id returned by quote.",
|
|
2821
3128
|
get: "Retrieve a ride order by id (poll for status changes with --watch).",
|
|
2822
3129
|
cancel: "Cancel a ride order by id (may incur a fee).",
|
|
3130
|
+
update: "Modify a booked ride: trip details and/or passenger info.",
|
|
3131
|
+
"trip-status": "Retrieve status and driver location points for one leg of a multi-leg ride.",
|
|
2823
3132
|
"list-orders": "List previously placed ride orders."
|
|
2824
3133
|
},
|
|
2825
|
-
workflow: [
|
|
3134
|
+
workflow: [
|
|
3135
|
+
"quote",
|
|
3136
|
+
"book",
|
|
3137
|
+
"get (poll for status)",
|
|
3138
|
+
"update (optional)",
|
|
3139
|
+
"trip-status (optional, multi-leg rides)",
|
|
3140
|
+
"cancel (optional)"
|
|
3141
|
+
],
|
|
2826
3142
|
since: "2026-06-01",
|
|
2827
3143
|
discovery: {
|
|
2828
3144
|
help_command: "agenzo-merchant-cli ride-elife --help"
|
|
@@ -3229,28 +3545,28 @@ function registerOrdersGetCommand(parent, deps) {
|
|
|
3229
3545
|
}
|
|
3230
3546
|
|
|
3231
3547
|
// src/hotel-redaug/search.ts
|
|
3232
|
-
function
|
|
3548
|
+
function need7(value, flag) {
|
|
3233
3549
|
if (value === void 0) {
|
|
3234
3550
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
3235
3551
|
}
|
|
3236
3552
|
return value;
|
|
3237
3553
|
}
|
|
3238
|
-
function
|
|
3239
|
-
const n = Number(
|
|
3554
|
+
function num4(value, flag) {
|
|
3555
|
+
const n = Number(need7(value, flag));
|
|
3240
3556
|
if (!Number.isFinite(n)) {
|
|
3241
3557
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
3242
3558
|
}
|
|
3243
3559
|
return n;
|
|
3244
3560
|
}
|
|
3245
3561
|
function coord(value, flag, min, max) {
|
|
3246
|
-
const n =
|
|
3562
|
+
const n = num4(value, flag);
|
|
3247
3563
|
if (n < min || n > max) {
|
|
3248
3564
|
throw new CliError("PARAM_INVALID", `--${flag} must be between ${min} and ${max}.`);
|
|
3249
3565
|
}
|
|
3250
3566
|
return n;
|
|
3251
3567
|
}
|
|
3252
3568
|
function positiveInt3(value, flag) {
|
|
3253
|
-
const n =
|
|
3569
|
+
const n = num4(value, flag);
|
|
3254
3570
|
if (!Number.isInteger(n) || n <= 0) {
|
|
3255
3571
|
throw new CliError("PARAM_INVALID", `--${flag} must be a positive integer.`);
|
|
3256
3572
|
}
|
|
@@ -3258,7 +3574,7 @@ function positiveInt3(value, flag) {
|
|
|
3258
3574
|
}
|
|
3259
3575
|
var YMD_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
3260
3576
|
function stayDate(value, flag) {
|
|
3261
|
-
const raw =
|
|
3577
|
+
const raw = need7(value, flag);
|
|
3262
3578
|
if (!YMD_RE.test(raw)) {
|
|
3263
3579
|
throw new CliError("PARAM_INVALID", `--${flag} must be a YYYY-MM-DD date.`);
|
|
3264
3580
|
}
|
|
@@ -3330,21 +3646,21 @@ function registerHotelSearchCommand(parent, deps) {
|
|
|
3330
3646
|
const pageSize = positiveInt3(opts.pageSize, "page-size");
|
|
3331
3647
|
const body = {};
|
|
3332
3648
|
if (hasDestination) {
|
|
3333
|
-
body.destination_id =
|
|
3649
|
+
body.destination_id = need7(opts.destinationId, "destination-id");
|
|
3334
3650
|
} else {
|
|
3335
3651
|
body.lat = coord(opts.lat, "lat", -90, 90);
|
|
3336
3652
|
body.lng = coord(opts.lng, "lng", -180, 180);
|
|
3337
3653
|
}
|
|
3338
|
-
body.distance =
|
|
3654
|
+
body.distance = num4(opts.distance, "distance");
|
|
3339
3655
|
body.check_in = checkIn;
|
|
3340
3656
|
body.check_out = checkOut;
|
|
3341
|
-
body.adults =
|
|
3342
|
-
body.children =
|
|
3343
|
-
body.room_num =
|
|
3344
|
-
if (opts.star !== void 0) body.star =
|
|
3657
|
+
body.adults = num4(opts.adults, "adults");
|
|
3658
|
+
body.children = num4(opts.children, "children");
|
|
3659
|
+
body.room_num = num4(opts.roomNum, "room-num");
|
|
3660
|
+
if (opts.star !== void 0) body.star = num4(opts.star, "star");
|
|
3345
3661
|
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 =
|
|
3662
|
+
if (opts.priceMin !== void 0) body.price_min = num4(opts.priceMin, "price-min");
|
|
3663
|
+
if (opts.priceMax !== void 0) body.price_max = num4(opts.priceMax, "price-max");
|
|
3348
3664
|
if (opts.sortBy !== void 0) body.sort_by = opts.sortBy;
|
|
3349
3665
|
body.page = page;
|
|
3350
3666
|
body.page_size = pageSize;
|
|
@@ -3373,14 +3689,14 @@ function registerHotelSearchCommand(parent, deps) {
|
|
|
3373
3689
|
}
|
|
3374
3690
|
|
|
3375
3691
|
// src/hotel-redaug/quote.ts
|
|
3376
|
-
function
|
|
3692
|
+
function need8(value, flag) {
|
|
3377
3693
|
if (value === void 0) {
|
|
3378
3694
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
3379
3695
|
}
|
|
3380
3696
|
return value;
|
|
3381
3697
|
}
|
|
3382
|
-
function
|
|
3383
|
-
const n = Number(
|
|
3698
|
+
function num5(value, flag) {
|
|
3699
|
+
const n = Number(need8(value, flag));
|
|
3384
3700
|
if (!Number.isFinite(n)) {
|
|
3385
3701
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
3386
3702
|
}
|
|
@@ -3388,7 +3704,7 @@ function num4(value, flag) {
|
|
|
3388
3704
|
}
|
|
3389
3705
|
var YMD_RE2 = /^\d{4}-\d{2}-\d{2}$/;
|
|
3390
3706
|
function stayDate2(value, flag) {
|
|
3391
|
-
const raw =
|
|
3707
|
+
const raw = need8(value, flag);
|
|
3392
3708
|
if (!YMD_RE2.test(raw)) {
|
|
3393
3709
|
throw new CliError("PARAM_INVALID", `--${flag} must be a YYYY-MM-DD date.`);
|
|
3394
3710
|
}
|
|
@@ -3428,7 +3744,7 @@ function registerHotelQuoteCommand(parent, deps) {
|
|
|
3428
3744
|
message: "API Key:",
|
|
3429
3745
|
type: "password"
|
|
3430
3746
|
});
|
|
3431
|
-
const hotelId =
|
|
3747
|
+
const hotelId = need8(opts.hotelId, "hotel-id");
|
|
3432
3748
|
const checkIn = stayDate2(opts.checkIn, "check-in");
|
|
3433
3749
|
const checkOut = stayDate2(opts.checkOut, "check-out");
|
|
3434
3750
|
if (!(checkOut > checkIn)) {
|
|
@@ -3438,9 +3754,9 @@ function registerHotelQuoteCommand(parent, deps) {
|
|
|
3438
3754
|
hotel_id: hotelId,
|
|
3439
3755
|
check_in: checkIn,
|
|
3440
3756
|
check_out: checkOut,
|
|
3441
|
-
adults:
|
|
3442
|
-
children:
|
|
3443
|
-
room_num:
|
|
3757
|
+
adults: num5(opts.adults, "adults"),
|
|
3758
|
+
children: num5(opts.children, "children"),
|
|
3759
|
+
room_num: num5(opts.roomNum, "room-num"),
|
|
3444
3760
|
nationality: opts.nationality
|
|
3445
3761
|
};
|
|
3446
3762
|
const result = await deps.apiClient.post(
|
|
@@ -3462,7 +3778,7 @@ function registerHotelQuoteCommand(parent, deps) {
|
|
|
3462
3778
|
}
|
|
3463
3779
|
|
|
3464
3780
|
// src/hotel-redaug/create-order.ts
|
|
3465
|
-
import { confirm as
|
|
3781
|
+
import { confirm as confirm4 } from "@inquirer/prompts";
|
|
3466
3782
|
function parsePriceItems(raw) {
|
|
3467
3783
|
const INVALID = "--price-items must be a JSON array of {sale_date (string), sale_price (number), breakfast_num (number)}.";
|
|
3468
3784
|
let parsed;
|
|
@@ -3520,14 +3836,14 @@ function parseCancellation(raw) {
|
|
|
3520
3836
|
}
|
|
3521
3837
|
return parsed;
|
|
3522
3838
|
}
|
|
3523
|
-
function
|
|
3839
|
+
function need9(value, flag) {
|
|
3524
3840
|
if (value === void 0) {
|
|
3525
3841
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
3526
3842
|
}
|
|
3527
3843
|
return value;
|
|
3528
3844
|
}
|
|
3529
|
-
function
|
|
3530
|
-
const n = Number(
|
|
3845
|
+
function num6(value, flag) {
|
|
3846
|
+
const n = Number(need9(value, flag));
|
|
3531
3847
|
if (!Number.isFinite(n)) {
|
|
3532
3848
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
3533
3849
|
}
|
|
@@ -3535,7 +3851,7 @@ function num5(value, flag) {
|
|
|
3535
3851
|
}
|
|
3536
3852
|
var YMD_RE3 = /^\d{4}-\d{2}-\d{2}$/;
|
|
3537
3853
|
function stayDate3(value, flag) {
|
|
3538
|
-
const raw =
|
|
3854
|
+
const raw = need9(value, flag);
|
|
3539
3855
|
if (!YMD_RE3.test(raw)) {
|
|
3540
3856
|
throw new CliError("PARAM_INVALID", `--${flag} must be a YYYY-MM-DD date.`);
|
|
3541
3857
|
}
|
|
@@ -3604,18 +3920,18 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3604
3920
|
message: "API Key:",
|
|
3605
3921
|
type: "password"
|
|
3606
3922
|
});
|
|
3607
|
-
const productToken =
|
|
3608
|
-
const totalAmount =
|
|
3609
|
-
const currency =
|
|
3610
|
-
const priceItems = parsePriceItems(
|
|
3923
|
+
const productToken = need9(opts.productToken, "product-token");
|
|
3924
|
+
const totalAmount = num6(opts.totalAmount, "total-amount");
|
|
3925
|
+
const currency = need9(opts.currency, "currency");
|
|
3926
|
+
const priceItems = parsePriceItems(need9(opts.priceItems, "price-items"));
|
|
3611
3927
|
const checkIn = stayDate3(opts.checkIn, "check-in");
|
|
3612
3928
|
const checkOut = stayDate3(opts.checkOut, "check-out");
|
|
3613
3929
|
if (!(checkOut > checkIn)) {
|
|
3614
3930
|
throw new CliError("PARAM_INVALID", "--check-out must be strictly after --check-in.");
|
|
3615
3931
|
}
|
|
3616
|
-
const guestName =
|
|
3617
|
-
const contactName =
|
|
3618
|
-
const contactPhone =
|
|
3932
|
+
const guestName = need9(opts.guestName, "guest-name");
|
|
3933
|
+
const contactName = need9(opts.contactName, "contact-name");
|
|
3934
|
+
const contactPhone = need9(opts.contactPhone, "contact-phone");
|
|
3619
3935
|
const body = {
|
|
3620
3936
|
product_token: productToken,
|
|
3621
3937
|
total_amount: totalAmount,
|
|
@@ -3623,9 +3939,9 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3623
3939
|
price_items: priceItems,
|
|
3624
3940
|
check_in: checkIn,
|
|
3625
3941
|
check_out: checkOut,
|
|
3626
|
-
room_num:
|
|
3627
|
-
adults:
|
|
3628
|
-
children:
|
|
3942
|
+
room_num: num6(opts.roomNum, "room-num"),
|
|
3943
|
+
adults: num6(opts.adults, "adults"),
|
|
3944
|
+
children: num6(opts.children, "children"),
|
|
3629
3945
|
nationality: opts.nationality,
|
|
3630
3946
|
guest_name: guestName,
|
|
3631
3947
|
contact_name: contactName,
|
|
@@ -3649,7 +3965,7 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3649
3965
|
if (member !== void 0) body.member_id = member;
|
|
3650
3966
|
if (!isYes) {
|
|
3651
3967
|
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
|
|
3968
|
+
const confirmed = await confirm4({
|
|
3653
3969
|
message: `Create this hotel order for ${totalAmount} ${currency} (check-in ${checkIn}, check-out ${checkOut})? ${chargeNote}`,
|
|
3654
3970
|
default: false
|
|
3655
3971
|
});
|
|
@@ -3683,7 +3999,7 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3683
3999
|
}
|
|
3684
4000
|
|
|
3685
4001
|
// src/hotel-redaug/pay-order.ts
|
|
3686
|
-
import { confirm as
|
|
4002
|
+
import { confirm as confirm5 } from "@inquirer/prompts";
|
|
3687
4003
|
|
|
3688
4004
|
// src/hotel-redaug/watch.ts
|
|
3689
4005
|
var DEFAULT_ORDER_WATCH_INTERVAL_SECONDS = 5;
|
|
@@ -3859,7 +4175,7 @@ function registerHotelPayOrderCommand(parent, deps) {
|
|
|
3859
4175
|
const watchTimeout = resolveSeconds(opts.watchTimeout, DEFAULT_PAY_WATCH_TIMEOUT_SECONDS);
|
|
3860
4176
|
const body = {};
|
|
3861
4177
|
if (!isYes) {
|
|
3862
|
-
const confirmed = await
|
|
4178
|
+
const confirmed = await confirm5({
|
|
3863
4179
|
message: `Settle hotel order ${orderId}? This moves money via the order's configured billing mode (monthly_settlement or pay_per_call).`,
|
|
3864
4180
|
default: false
|
|
3865
4181
|
});
|
|
@@ -3937,7 +4253,7 @@ function registerHotelPayOrderCommand(parent, deps) {
|
|
|
3937
4253
|
}
|
|
3938
4254
|
|
|
3939
4255
|
// src/hotel-redaug/get.ts
|
|
3940
|
-
function
|
|
4256
|
+
function need10(value, flag) {
|
|
3941
4257
|
if (value === void 0) {
|
|
3942
4258
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
3943
4259
|
}
|
|
@@ -4001,7 +4317,7 @@ function registerHotelGetCommand(parent, deps) {
|
|
|
4001
4317
|
message: "API Key:",
|
|
4002
4318
|
type: "password"
|
|
4003
4319
|
});
|
|
4004
|
-
const orderId =
|
|
4320
|
+
const orderId = need10(opts.orderId, "order-id");
|
|
4005
4321
|
if (opts.watch) {
|
|
4006
4322
|
await watchOrderStatus(deps.apiClient, apiKey, orderId, {
|
|
4007
4323
|
intervalSeconds: resolveSeconds(
|
|
@@ -4035,7 +4351,7 @@ function registerHotelGetCommand(parent, deps) {
|
|
|
4035
4351
|
}
|
|
4036
4352
|
|
|
4037
4353
|
// src/hotel-redaug/cancel.ts
|
|
4038
|
-
function
|
|
4354
|
+
function need11(value, flag) {
|
|
4039
4355
|
if (value === void 0) {
|
|
4040
4356
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4041
4357
|
}
|
|
@@ -4088,8 +4404,8 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
4088
4404
|
message: "API Key:",
|
|
4089
4405
|
type: "password"
|
|
4090
4406
|
});
|
|
4091
|
-
const orderId =
|
|
4092
|
-
const fcOrderCode =
|
|
4407
|
+
const orderId = need11(opts.orderId, "order-id");
|
|
4408
|
+
const fcOrderCode = need11(opts.fcOrderCode, "fc-order-code");
|
|
4093
4409
|
const body = { fc_order_code: fcOrderCode };
|
|
4094
4410
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
4095
4411
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -4118,15 +4434,15 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
4118
4434
|
}
|
|
4119
4435
|
|
|
4120
4436
|
// src/hotel-redaug/checkout.ts
|
|
4121
|
-
import { confirm as
|
|
4122
|
-
function
|
|
4437
|
+
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
4438
|
+
function need12(value, flag) {
|
|
4123
4439
|
if (value === void 0) {
|
|
4124
4440
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4125
4441
|
}
|
|
4126
4442
|
return value;
|
|
4127
4443
|
}
|
|
4128
|
-
function
|
|
4129
|
-
const n = Number(
|
|
4444
|
+
function num7(value, flag) {
|
|
4445
|
+
const n = Number(need12(value, flag));
|
|
4130
4446
|
if (!Number.isFinite(n)) {
|
|
4131
4447
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4132
4448
|
}
|
|
@@ -4192,11 +4508,11 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
4192
4508
|
message: "API Key:",
|
|
4193
4509
|
type: "password"
|
|
4194
4510
|
});
|
|
4195
|
-
const orderId =
|
|
4196
|
-
const fcOrderCode =
|
|
4197
|
-
const reason =
|
|
4198
|
-
const checkoutRooms = parseCheckoutRooms(
|
|
4199
|
-
const refundType =
|
|
4511
|
+
const orderId = need12(opts.orderId, "order-id");
|
|
4512
|
+
const fcOrderCode = need12(opts.fcOrderCode, "fc-order-code");
|
|
4513
|
+
const reason = need12(opts.reason, "reason");
|
|
4514
|
+
const checkoutRooms = parseCheckoutRooms(need12(opts.checkoutRooms, "checkout-rooms"));
|
|
4515
|
+
const refundType = num7(opts.refundType, "refund-type");
|
|
4200
4516
|
const body = {
|
|
4201
4517
|
fc_order_code: fcOrderCode,
|
|
4202
4518
|
reason,
|
|
@@ -4204,7 +4520,7 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
4204
4520
|
checkout_rooms: checkoutRooms
|
|
4205
4521
|
};
|
|
4206
4522
|
if (!isYes) {
|
|
4207
|
-
const confirmed = await
|
|
4523
|
+
const confirmed = await confirm6({
|
|
4208
4524
|
message: `Request check-out / out-of-policy cancellation for order ${orderId} (${checkoutRooms.length} room(s))? The property must approve and charges may apply.`,
|
|
4209
4525
|
default: false
|
|
4210
4526
|
});
|
|
@@ -4238,7 +4554,7 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
4238
4554
|
}
|
|
4239
4555
|
|
|
4240
4556
|
// src/hotel-redaug/get-checkout.ts
|
|
4241
|
-
function
|
|
4557
|
+
function need13(value, flag) {
|
|
4242
4558
|
if (value === void 0) {
|
|
4243
4559
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4244
4560
|
}
|
|
@@ -4274,7 +4590,7 @@ function registerHotelGetCheckoutCommand(parent, deps) {
|
|
|
4274
4590
|
message: "API Key:",
|
|
4275
4591
|
type: "password"
|
|
4276
4592
|
});
|
|
4277
|
-
const taskOrderCode =
|
|
4593
|
+
const taskOrderCode = need13(opts.taskOrderCode, "task-order-code");
|
|
4278
4594
|
if (opts.watch) {
|
|
4279
4595
|
await watchCheckoutStatus(deps.apiClient, apiKey, taskOrderCode, {
|
|
4280
4596
|
intervalSeconds: resolveSeconds(
|
|
@@ -4378,7 +4694,7 @@ function registerHotelListOrdersCommand(parent, deps) {
|
|
|
4378
4694
|
}
|
|
4379
4695
|
|
|
4380
4696
|
// src/hotel-redaug/find-destination.ts
|
|
4381
|
-
function
|
|
4697
|
+
function need14(value, flag) {
|
|
4382
4698
|
if (value === void 0 || value.trim() === "") {
|
|
4383
4699
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4384
4700
|
}
|
|
@@ -4412,7 +4728,7 @@ function registerHotelFindDestinationCommand(parent, deps) {
|
|
|
4412
4728
|
message: "API Key:",
|
|
4413
4729
|
type: "password"
|
|
4414
4730
|
});
|
|
4415
|
-
const keyword =
|
|
4731
|
+
const keyword = need14(opts.keyword, "keyword");
|
|
4416
4732
|
const body = { keyword };
|
|
4417
4733
|
if (opts.dataType !== void 0) {
|
|
4418
4734
|
body.data_type = opts.dataType;
|
|
@@ -4436,21 +4752,21 @@ function registerHotelFindDestinationCommand(parent, deps) {
|
|
|
4436
4752
|
}
|
|
4437
4753
|
|
|
4438
4754
|
// src/hotel-redaug/hotel-filters.ts
|
|
4439
|
-
function
|
|
4755
|
+
function need15(value, flag) {
|
|
4440
4756
|
if (value === void 0 || value.trim() === "") {
|
|
4441
4757
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4442
4758
|
}
|
|
4443
4759
|
return value;
|
|
4444
4760
|
}
|
|
4445
|
-
function
|
|
4446
|
-
const n = Number(
|
|
4761
|
+
function num8(value, flag) {
|
|
4762
|
+
const n = Number(need15(value, flag));
|
|
4447
4763
|
if (!Number.isFinite(n)) {
|
|
4448
4764
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4449
4765
|
}
|
|
4450
4766
|
return n;
|
|
4451
4767
|
}
|
|
4452
4768
|
function coord2(value, flag, min, max) {
|
|
4453
|
-
const n =
|
|
4769
|
+
const n = num8(value, flag);
|
|
4454
4770
|
if (n < min || n > max) {
|
|
4455
4771
|
throw new CliError("PARAM_INVALID", `--${flag} must be between ${min} and ${max}.`);
|
|
4456
4772
|
}
|
|
@@ -4523,12 +4839,12 @@ function registerHotelFiltersCommand(parent, deps) {
|
|
|
4523
4839
|
}
|
|
4524
4840
|
const body = {};
|
|
4525
4841
|
if (hasDestination) {
|
|
4526
|
-
body.destination_id =
|
|
4842
|
+
body.destination_id = need15(opts.destinationId, "destination-id");
|
|
4527
4843
|
} else {
|
|
4528
4844
|
body.lat = coord2(opts.lat, "lat", -90, 90);
|
|
4529
4845
|
body.lng = coord2(opts.lng, "lng", -180, 180);
|
|
4530
4846
|
}
|
|
4531
|
-
body.distance =
|
|
4847
|
+
body.distance = num8(opts.distance, "distance");
|
|
4532
4848
|
const result = await deps.apiClient.post(
|
|
4533
4849
|
"/hotel/filters",
|
|
4534
4850
|
{ type: "api-key", key: apiKey },
|
|
@@ -4548,7 +4864,7 @@ function registerHotelFiltersCommand(parent, deps) {
|
|
|
4548
4864
|
}
|
|
4549
4865
|
|
|
4550
4866
|
// src/hotel-redaug/list-cities.ts
|
|
4551
|
-
function
|
|
4867
|
+
function need16(value, flag) {
|
|
4552
4868
|
if (value === void 0 || value.trim() === "") {
|
|
4553
4869
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4554
4870
|
}
|
|
@@ -4581,7 +4897,7 @@ function registerHotelListCitiesCommand(parent, deps) {
|
|
|
4581
4897
|
message: "API Key:",
|
|
4582
4898
|
type: "password"
|
|
4583
4899
|
});
|
|
4584
|
-
const country =
|
|
4900
|
+
const country = need16(opts.country, "country");
|
|
4585
4901
|
const body = { country_code: country };
|
|
4586
4902
|
const result = await deps.apiClient.post(
|
|
4587
4903
|
"/hotel/cities",
|
|
@@ -4602,7 +4918,7 @@ function registerHotelListCitiesCommand(parent, deps) {
|
|
|
4602
4918
|
}
|
|
4603
4919
|
|
|
4604
4920
|
// src/hotel-redaug/hotel-detail.ts
|
|
4605
|
-
function
|
|
4921
|
+
function need17(value, flag) {
|
|
4606
4922
|
if (value === void 0 || value.trim() === "") {
|
|
4607
4923
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4608
4924
|
}
|
|
@@ -4749,7 +5065,7 @@ function registerHotelDetailCommand(parent, deps) {
|
|
|
4749
5065
|
message: "API Key:",
|
|
4750
5066
|
type: "password"
|
|
4751
5067
|
});
|
|
4752
|
-
const hotelId =
|
|
5068
|
+
const hotelId = need17(opts.hotelId, "hotel-id");
|
|
4753
5069
|
const rawWithImages = opts.withImages;
|
|
4754
5070
|
const withImages = rawWithImages !== "false" && rawWithImages !== false;
|
|
4755
5071
|
const settings = parseSettings(opts.settings);
|
|
@@ -4957,14 +5273,14 @@ function registerHotelSkillCommand(parent) {
|
|
|
4957
5273
|
}
|
|
4958
5274
|
|
|
4959
5275
|
// src/flight-flink/_helpers.ts
|
|
4960
|
-
function
|
|
5276
|
+
function need18(value, flag) {
|
|
4961
5277
|
if (value === void 0) {
|
|
4962
5278
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4963
5279
|
}
|
|
4964
5280
|
return value;
|
|
4965
5281
|
}
|
|
4966
|
-
function
|
|
4967
|
-
const n = Number(
|
|
5282
|
+
function num9(value, flag) {
|
|
5283
|
+
const n = Number(need18(value, flag));
|
|
4968
5284
|
if (!Number.isFinite(n)) {
|
|
4969
5285
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4970
5286
|
}
|
|
@@ -4999,7 +5315,7 @@ function registerFindAirportCommand(parent, deps) {
|
|
|
4999
5315
|
const opts = cmd.optsWithGlobals();
|
|
5000
5316
|
const format = resolveFormat(opts.format);
|
|
5001
5317
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5002
|
-
const keyword =
|
|
5318
|
+
const keyword = need18(opts.keyword, "keyword");
|
|
5003
5319
|
const spinner = format === "json" ? null : createSpinner("Resolving airports...");
|
|
5004
5320
|
const result = await deps.apiClient.post(
|
|
5005
5321
|
"/flight/find-airport",
|
|
@@ -5025,8 +5341,8 @@ function registerListAirportsCommand(parent, deps) {
|
|
|
5025
5341
|
const format = resolveFormat(opts.format);
|
|
5026
5342
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5027
5343
|
const body = {
|
|
5028
|
-
page:
|
|
5029
|
-
page_size:
|
|
5344
|
+
page: num9(opts.page, "page"),
|
|
5345
|
+
page_size: num9(opts.pageSize, "page-size")
|
|
5030
5346
|
};
|
|
5031
5347
|
if (opts.keyword !== void 0) body.keyword = opts.keyword;
|
|
5032
5348
|
const spinner = format === "json" ? null : createSpinner("Fetching airports...");
|
|
@@ -5050,8 +5366,8 @@ function registerListAirlinesCommand(parent, deps) {
|
|
|
5050
5366
|
const format = resolveFormat(opts.format);
|
|
5051
5367
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5052
5368
|
const body = {
|
|
5053
|
-
page:
|
|
5054
|
-
page_size:
|
|
5369
|
+
page: num9(opts.page, "page"),
|
|
5370
|
+
page_size: num9(opts.pageSize, "page-size")
|
|
5055
5371
|
};
|
|
5056
5372
|
if (opts.keyword !== void 0) body.keyword = opts.keyword;
|
|
5057
5373
|
const spinner = format === "json" ? null : createSpinner("Fetching airlines...");
|
|
@@ -5095,13 +5411,13 @@ function registerSearchCommand(parent, deps) {
|
|
|
5095
5411
|
const format = resolveFormat(opts.format);
|
|
5096
5412
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5097
5413
|
const body = {
|
|
5098
|
-
trip_type:
|
|
5099
|
-
journeys: jsonArray(
|
|
5414
|
+
trip_type: num9(opts.tripType, "trip-type"),
|
|
5415
|
+
journeys: jsonArray(need18(opts.journeys, "journeys"), "journeys"),
|
|
5100
5416
|
cabin_class: opts.cabinClass,
|
|
5101
|
-
adult_num:
|
|
5102
|
-
child_num:
|
|
5103
|
-
infant_num:
|
|
5104
|
-
transfer_number:
|
|
5417
|
+
adult_num: num9(opts.adultNum, "adult-num"),
|
|
5418
|
+
child_num: num9(opts.childNum, "child-num"),
|
|
5419
|
+
infant_num: num9(opts.infantNum, "infant-num"),
|
|
5420
|
+
transfer_number: num9(opts.transferNumber, "transfer-number")
|
|
5105
5421
|
};
|
|
5106
5422
|
if (opts.airline !== void 0) body.airline = opts.airline;
|
|
5107
5423
|
if (opts.journeyId !== void 0) {
|
|
@@ -5127,7 +5443,7 @@ function registerMoreOffersCommand(parent, deps) {
|
|
|
5127
5443
|
const opts = cmd.optsWithGlobals();
|
|
5128
5444
|
const format = resolveFormat(opts.format);
|
|
5129
5445
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5130
|
-
const productToken =
|
|
5446
|
+
const productToken = need18(opts.productToken, "product-token");
|
|
5131
5447
|
const spinner = format === "json" ? null : createSpinner("Fetching offers...");
|
|
5132
5448
|
const result = await deps.apiClient.post(
|
|
5133
5449
|
"/flight/more-offers",
|
|
@@ -5148,7 +5464,7 @@ function registerVerifyCommand(parent, deps) {
|
|
|
5148
5464
|
const opts = cmd.optsWithGlobals();
|
|
5149
5465
|
const format = resolveFormat(opts.format);
|
|
5150
5466
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5151
|
-
const productToken =
|
|
5467
|
+
const productToken = need18(opts.productToken, "product-token");
|
|
5152
5468
|
const spinner = format === "json" ? null : createSpinner("Verifying price...");
|
|
5153
5469
|
const result = await deps.apiClient.post(
|
|
5154
5470
|
"/flight/verify",
|
|
@@ -5170,7 +5486,7 @@ function registerVerifyCommand(parent, deps) {
|
|
|
5170
5486
|
}
|
|
5171
5487
|
|
|
5172
5488
|
// src/flight-flink/create-order.ts
|
|
5173
|
-
import { confirm as
|
|
5489
|
+
import { confirm as confirm7 } from "@inquirer/prompts";
|
|
5174
5490
|
function registerCreateOrderCommand(parent, deps) {
|
|
5175
5491
|
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
5492
|
"--authorized-merchant-trans-id <id>",
|
|
@@ -5182,19 +5498,19 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
5182
5498
|
const format = resolveFormat(opts.format);
|
|
5183
5499
|
const isYes = Boolean(opts.yes);
|
|
5184
5500
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5185
|
-
const productToken =
|
|
5186
|
-
const totalAmount =
|
|
5187
|
-
const currency =
|
|
5501
|
+
const productToken = need18(opts.productToken, "product-token");
|
|
5502
|
+
const totalAmount = num9(opts.totalAmount, "total-amount");
|
|
5503
|
+
const currency = need18(opts.currency, "currency");
|
|
5188
5504
|
const body = {
|
|
5189
5505
|
product_token: productToken,
|
|
5190
5506
|
total_amount: totalAmount,
|
|
5191
5507
|
currency,
|
|
5192
|
-
trip_type:
|
|
5193
|
-
contact_name:
|
|
5194
|
-
contact_region:
|
|
5195
|
-
contact_phone:
|
|
5196
|
-
contact_email:
|
|
5197
|
-
passengers: jsonArray(
|
|
5508
|
+
trip_type: num9(opts.tripType, "trip-type"),
|
|
5509
|
+
contact_name: need18(opts.contactName, "contact-name"),
|
|
5510
|
+
contact_region: need18(opts.contactRegion, "contact-region"),
|
|
5511
|
+
contact_phone: need18(opts.contactPhone, "contact-phone"),
|
|
5512
|
+
contact_email: need18(opts.contactEmail, "contact-email"),
|
|
5513
|
+
passengers: jsonArray(need18(opts.passengers, "passengers"), "passengers")
|
|
5198
5514
|
};
|
|
5199
5515
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5200
5516
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
@@ -5204,7 +5520,7 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
5204
5520
|
const member = memberIdOf(opts);
|
|
5205
5521
|
if (member !== void 0) body.member_id = member;
|
|
5206
5522
|
if (!isYes) {
|
|
5207
|
-
const ok = await
|
|
5523
|
+
const ok = await confirm7({
|
|
5208
5524
|
message: `Create this flight order for ${totalAmount} ${currency}? This locks the fare but does NOT charge yet.`,
|
|
5209
5525
|
default: false
|
|
5210
5526
|
});
|
|
@@ -5243,18 +5559,21 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
5243
5559
|
}
|
|
5244
5560
|
|
|
5245
5561
|
// src/flight-flink/pay-order.ts
|
|
5246
|
-
import { confirm as
|
|
5562
|
+
import { confirm as confirm8 } from "@inquirer/prompts";
|
|
5247
5563
|
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("--
|
|
5564
|
+
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(
|
|
5565
|
+
"--authorized-merchant-trans-id <id>",
|
|
5566
|
+
"Resume a 3DS challenge: merchant trans id of an already-authorised preauth"
|
|
5567
|
+
).option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5249
5568
|
attachSchemaHelp(cmd, flightPayOrderSchema);
|
|
5250
5569
|
cmd.action(async () => {
|
|
5251
5570
|
const opts = cmd.optsWithGlobals();
|
|
5252
5571
|
const format = resolveFormat(opts.format);
|
|
5253
5572
|
const isYes = Boolean(opts.yes);
|
|
5254
5573
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5255
|
-
const orderNo =
|
|
5574
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5256
5575
|
if (!isYes) {
|
|
5257
|
-
const ok = await
|
|
5576
|
+
const ok = await confirm8({
|
|
5258
5577
|
message: `Pay and ticket order ${orderNo}? This settles the order and issues tickets.`,
|
|
5259
5578
|
default: false
|
|
5260
5579
|
});
|
|
@@ -5265,10 +5584,16 @@ function registerPayOrderCommand(parent, deps) {
|
|
|
5265
5584
|
commandPath: "flight-flink pay-order"
|
|
5266
5585
|
});
|
|
5267
5586
|
const spinner = format === "json" ? null : createSpinner("Paying flight order...");
|
|
5587
|
+
const body = {};
|
|
5588
|
+
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5589
|
+
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
5590
|
+
if (opts.authorizedMerchantTransId !== void 0) {
|
|
5591
|
+
body.authorized_merchant_trans_id = opts.authorizedMerchantTransId;
|
|
5592
|
+
}
|
|
5268
5593
|
const result = await deps.apiClient.post(
|
|
5269
5594
|
`/flight/${encodeURIComponent(orderNo)}/pay`,
|
|
5270
5595
|
{ type: "api-key", key: apiKey },
|
|
5271
|
-
|
|
5596
|
+
body,
|
|
5272
5597
|
{ "Idempotency-Key": idempotencyKey }
|
|
5273
5598
|
);
|
|
5274
5599
|
spinner?.stop();
|
|
@@ -5297,12 +5622,12 @@ function registerGetOrderCommand(parent, deps) {
|
|
|
5297
5622
|
const opts = cmd.optsWithGlobals();
|
|
5298
5623
|
const format = resolveFormat(opts.format);
|
|
5299
5624
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5300
|
-
const orderNo =
|
|
5625
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5301
5626
|
const path = `/flight/${encodeURIComponent(orderNo)}/status`;
|
|
5302
5627
|
const auth = { type: "api-key", key: apiKey };
|
|
5303
5628
|
if (opts.watch) {
|
|
5304
|
-
const interval =
|
|
5305
|
-
const timeoutMs =
|
|
5629
|
+
const interval = num9(opts.watchInterval, "watch-interval") * 1e3;
|
|
5630
|
+
const timeoutMs = num9(opts.watchTimeout, "watch-timeout") * 1e3;
|
|
5306
5631
|
const deadline = Date.now() + timeoutMs;
|
|
5307
5632
|
for (; ; ) {
|
|
5308
5633
|
const r = await deps.apiClient.get(path, auth);
|
|
@@ -5337,7 +5662,7 @@ function registerGetOrderCommand(parent, deps) {
|
|
|
5337
5662
|
}
|
|
5338
5663
|
|
|
5339
5664
|
// src/flight-flink/cancel-order.ts
|
|
5340
|
-
import { confirm as
|
|
5665
|
+
import { confirm as confirm9 } from "@inquirer/prompts";
|
|
5341
5666
|
function registerCancelOrderCommand(parent, deps) {
|
|
5342
5667
|
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
5668
|
attachSchemaHelp(cmd, flightCancelOrderSchema);
|
|
@@ -5346,9 +5671,9 @@ function registerCancelOrderCommand(parent, deps) {
|
|
|
5346
5671
|
const format = resolveFormat(opts.format);
|
|
5347
5672
|
const isYes = Boolean(opts.yes);
|
|
5348
5673
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5349
|
-
const orderNo =
|
|
5674
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5350
5675
|
if (!isYes) {
|
|
5351
|
-
const ok = await
|
|
5676
|
+
const ok = await confirm9({
|
|
5352
5677
|
message: `Cancel order ${orderNo}? This requests cancellation and a refund.`,
|
|
5353
5678
|
default: false
|
|
5354
5679
|
});
|
|
@@ -5393,8 +5718,8 @@ function registerListOrdersCommand2(parent, deps) {
|
|
|
5393
5718
|
if (opts.status !== void 0) params.set("status", opts.status);
|
|
5394
5719
|
const member = memberIdOf(opts);
|
|
5395
5720
|
if (member !== void 0) params.set("member_id", member);
|
|
5396
|
-
params.set("page", String(
|
|
5397
|
-
params.set("page_size", String(
|
|
5721
|
+
params.set("page", String(num9(opts.page, "page")));
|
|
5722
|
+
params.set("page_size", String(num9(opts.pageSize, "page-size")));
|
|
5398
5723
|
const spinner = format === "json" ? null : createSpinner("Fetching flight orders...");
|
|
5399
5724
|
const result = await deps.apiClient.get(
|
|
5400
5725
|
`/flight/orders?${params.toString()}`,
|
|
@@ -5422,10 +5747,10 @@ function registerChangeSearchCommand(parent, deps) {
|
|
|
5422
5747
|
const format = resolveFormat(opts.format);
|
|
5423
5748
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5424
5749
|
const body = {
|
|
5425
|
-
order_no:
|
|
5426
|
-
date:
|
|
5427
|
-
passenger:
|
|
5428
|
-
segment_id:
|
|
5750
|
+
order_no: need18(opts.orderNo, "order-no"),
|
|
5751
|
+
date: need18(opts.date, "date"),
|
|
5752
|
+
passenger: need18(opts.passenger, "passenger"),
|
|
5753
|
+
segment_id: need18(opts.segmentId, "segment-id"),
|
|
5429
5754
|
cabin_class: opts.cabinClass
|
|
5430
5755
|
};
|
|
5431
5756
|
const spinner = format === "json" ? null : createSpinner("Searching change options...");
|
|
@@ -5441,7 +5766,7 @@ function registerChangeSearchCommand(parent, deps) {
|
|
|
5441
5766
|
}
|
|
5442
5767
|
|
|
5443
5768
|
// src/flight-flink/change-apply.ts
|
|
5444
|
-
import { confirm as
|
|
5769
|
+
import { confirm as confirm10 } from "@inquirer/prompts";
|
|
5445
5770
|
function registerChangeApplyCommand(parent, deps) {
|
|
5446
5771
|
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
5772
|
attachSchemaHelp(cmd, flightChangeApplySchema);
|
|
@@ -5451,17 +5776,17 @@ function registerChangeApplyCommand(parent, deps) {
|
|
|
5451
5776
|
const isYes = Boolean(opts.yes);
|
|
5452
5777
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5453
5778
|
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:
|
|
5779
|
+
order_no: need18(opts.orderNo, "order-no"),
|
|
5780
|
+
passenger: need18(opts.passenger, "passenger"),
|
|
5781
|
+
segment_id: need18(opts.segmentId, "segment-id"),
|
|
5782
|
+
product_token: need18(opts.productToken, "product-token"),
|
|
5783
|
+
contact_name: need18(opts.contactName, "contact-name"),
|
|
5784
|
+
contact_region: need18(opts.contactRegion, "contact-region"),
|
|
5785
|
+
contact_phone: need18(opts.contactPhone, "contact-phone"),
|
|
5786
|
+
contact_email: need18(opts.contactEmail, "contact-email")
|
|
5462
5787
|
};
|
|
5463
5788
|
if (!isYes) {
|
|
5464
|
-
const ok = await
|
|
5789
|
+
const ok = await confirm10({
|
|
5465
5790
|
message: `Submit a change request for order ${body.order_no}?`,
|
|
5466
5791
|
default: false
|
|
5467
5792
|
});
|
|
@@ -5492,7 +5817,7 @@ function registerChangeDetailCommand(parent, deps) {
|
|
|
5492
5817
|
const opts = cmd.optsWithGlobals();
|
|
5493
5818
|
const format = resolveFormat(opts.format);
|
|
5494
5819
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5495
|
-
const changeOrderNo =
|
|
5820
|
+
const changeOrderNo = need18(opts.changeOrderNo, "change-order-no");
|
|
5496
5821
|
const spinner = format === "json" ? null : createSpinner("Fetching change detail...");
|
|
5497
5822
|
const result = await deps.apiClient.get(
|
|
5498
5823
|
`/flight/change/${encodeURIComponent(changeOrderNo)}`,
|
|
@@ -5505,7 +5830,7 @@ function registerChangeDetailCommand(parent, deps) {
|
|
|
5505
5830
|
}
|
|
5506
5831
|
|
|
5507
5832
|
// src/flight-flink/change-cancel.ts
|
|
5508
|
-
import { confirm as
|
|
5833
|
+
import { confirm as confirm11 } from "@inquirer/prompts";
|
|
5509
5834
|
function registerChangeCancelCommand(parent, deps) {
|
|
5510
5835
|
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
5836
|
attachSchemaHelp(cmd, flightChangeCancelSchema);
|
|
@@ -5514,9 +5839,9 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5514
5839
|
const format = resolveFormat(opts.format);
|
|
5515
5840
|
const isYes = Boolean(opts.yes);
|
|
5516
5841
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5517
|
-
const changeOrderNo =
|
|
5842
|
+
const changeOrderNo = need18(opts.changeOrderNo, "change-order-no");
|
|
5518
5843
|
if (!isYes) {
|
|
5519
|
-
const ok = await
|
|
5844
|
+
const ok = await confirm11({ message: `Cancel change request ${changeOrderNo}?`, default: false });
|
|
5520
5845
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Change cancellation aborted by user.");
|
|
5521
5846
|
}
|
|
5522
5847
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5537,7 +5862,7 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5537
5862
|
}
|
|
5538
5863
|
|
|
5539
5864
|
// src/flight-flink/change-pay.ts
|
|
5540
|
-
import { confirm as
|
|
5865
|
+
import { confirm as confirm12 } from "@inquirer/prompts";
|
|
5541
5866
|
function registerChangePayCommand(parent, deps) {
|
|
5542
5867
|
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
5868
|
attachSchemaHelp(cmd, flightChangePaySchema);
|
|
@@ -5546,10 +5871,10 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5546
5871
|
const format = resolveFormat(opts.format);
|
|
5547
5872
|
const isYes = Boolean(opts.yes);
|
|
5548
5873
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5549
|
-
const changeOrderNo =
|
|
5550
|
-
const orderNo =
|
|
5551
|
-
const amount =
|
|
5552
|
-
const currency =
|
|
5874
|
+
const changeOrderNo = need18(opts.changeOrderNo, "change-order-no");
|
|
5875
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5876
|
+
const amount = num9(opts.amount, "amount");
|
|
5877
|
+
const currency = need18(opts.currency, "currency");
|
|
5553
5878
|
const body = {
|
|
5554
5879
|
order_no: orderNo,
|
|
5555
5880
|
amount,
|
|
@@ -5558,7 +5883,7 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5558
5883
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5559
5884
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
5560
5885
|
if (!isYes) {
|
|
5561
|
-
const ok = await
|
|
5886
|
+
const ok = await confirm12({
|
|
5562
5887
|
message: `Pay change fee ${amount} ${currency} for change order ${changeOrderNo}? This charges the customer and triggers change ticketing.`,
|
|
5563
5888
|
default: false
|
|
5564
5889
|
});
|
|
@@ -5594,7 +5919,7 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5594
5919
|
}
|
|
5595
5920
|
|
|
5596
5921
|
// src/flight-flink/refund-apply.ts
|
|
5597
|
-
import { confirm as
|
|
5922
|
+
import { confirm as confirm13 } from "@inquirer/prompts";
|
|
5598
5923
|
function registerRefundApplyCommand(parent, deps) {
|
|
5599
5924
|
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
5925
|
attachSchemaHelp(cmd, flightRefundApplySchema);
|
|
@@ -5604,18 +5929,18 @@ function registerRefundApplyCommand(parent, deps) {
|
|
|
5604
5929
|
const isYes = Boolean(opts.yes);
|
|
5605
5930
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5606
5931
|
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:
|
|
5932
|
+
order_no: need18(opts.orderNo, "order-no"),
|
|
5933
|
+
passenger: need18(opts.passenger, "passenger"),
|
|
5934
|
+
segment_id: need18(opts.segmentId, "segment-id"),
|
|
5935
|
+
reason_type: num9(opts.reasonType, "reason-type"),
|
|
5936
|
+
contact_name: need18(opts.contactName, "contact-name"),
|
|
5937
|
+
contact_region: need18(opts.contactRegion, "contact-region"),
|
|
5938
|
+
contact_phone: need18(opts.contactPhone, "contact-phone"),
|
|
5939
|
+
contact_email: need18(opts.contactEmail, "contact-email")
|
|
5615
5940
|
};
|
|
5616
5941
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
5617
5942
|
if (!isYes) {
|
|
5618
|
-
const ok = await
|
|
5943
|
+
const ok = await confirm13({
|
|
5619
5944
|
message: `Submit a refund request for order ${body.order_no}?`,
|
|
5620
5945
|
default: false
|
|
5621
5946
|
});
|
|
@@ -5646,7 +5971,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
5646
5971
|
const opts = cmd.optsWithGlobals();
|
|
5647
5972
|
const format = resolveFormat(opts.format);
|
|
5648
5973
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5649
|
-
const refundOrderNo =
|
|
5974
|
+
const refundOrderNo = need18(opts.refundOrderNo, "refund-order-no");
|
|
5650
5975
|
const spinner = format === "json" ? null : createSpinner("Fetching refund detail...");
|
|
5651
5976
|
const result = await deps.apiClient.get(
|
|
5652
5977
|
`/flight/refund/${encodeURIComponent(refundOrderNo)}`,
|
|
@@ -5659,7 +5984,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
5659
5984
|
}
|
|
5660
5985
|
|
|
5661
5986
|
// src/flight-flink/refund-confirm.ts
|
|
5662
|
-
import { confirm as
|
|
5987
|
+
import { confirm as confirm14 } from "@inquirer/prompts";
|
|
5663
5988
|
function registerRefundConfirmCommand(parent, deps) {
|
|
5664
5989
|
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
5990
|
attachSchemaHelp(cmd, flightRefundConfirmSchema);
|
|
@@ -5668,14 +5993,14 @@ function registerRefundConfirmCommand(parent, deps) {
|
|
|
5668
5993
|
const format = resolveFormat(opts.format);
|
|
5669
5994
|
const isYes = Boolean(opts.yes);
|
|
5670
5995
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5671
|
-
const refundOrderNo =
|
|
5672
|
-
const confirmFlag =
|
|
5996
|
+
const refundOrderNo = need18(opts.refundOrderNo, "refund-order-no");
|
|
5997
|
+
const confirmFlag = need18(opts.confirm, "confirm");
|
|
5673
5998
|
if (confirmFlag !== "1" && confirmFlag !== "2") {
|
|
5674
5999
|
throw new CliError("PARAM_INVALID", '--confirm must be "1" (confirm) or "2" (cancel).');
|
|
5675
6000
|
}
|
|
5676
6001
|
if (!isYes) {
|
|
5677
6002
|
const action = confirmFlag === "1" ? "confirm" : "cancel";
|
|
5678
|
-
const ok = await
|
|
6003
|
+
const ok = await confirm14({ message: `${action} refund ${refundOrderNo}?`, default: false });
|
|
5679
6004
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Refund confirmation aborted by user.");
|
|
5680
6005
|
}
|
|
5681
6006
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5805,13 +6130,16 @@ async function main() {
|
|
|
5805
6130
|
process.env.AGENZO_FORMAT = resolveFormat(flag);
|
|
5806
6131
|
});
|
|
5807
6132
|
const rideCmd = program.command("ride-elife").description(
|
|
5808
|
-
`Ride ordering (eLife) \u2014 quote a fare, book it, poll status, and cancel.
|
|
6133
|
+
`Ride ordering (eLife) \u2014 quote a fare, book it, poll status, modify it, and cancel.
|
|
5809
6134
|
|
|
5810
6135
|
Workflow (typical order):
|
|
5811
6136
|
1. quote Get fare quotes between two points \u2192 vehicle_classes[] each with a quote_id
|
|
5812
6137
|
2. book Book one vehicle_class using its quote_id \u2192 ride_id (write; needs --idempotency-key)
|
|
5813
6138
|
3. get Poll ride status by --order-id=<ride_id> until terminal (or use --watch for NDJSON)
|
|
5814
6139
|
4. cancel (optional) Cancel a ride by --order-id (write; may incur a fee)
|
|
6140
|
+
update (optional) Modify trip details and/or passenger of a booked ride
|
|
6141
|
+
(write; needs --idempotency-key; the fare may change)
|
|
6142
|
+
trip-status (optional) Status + driver location points of ONE leg of a multi-leg ride
|
|
5815
6143
|
list-orders (standalone) List the developer's previous ride orders
|
|
5816
6144
|
|
|
5817
6145
|
Key notes:
|
|
@@ -5826,13 +6154,19 @@ Key notes:
|
|
|
5826
6154
|
\u2022 All amounts are DECIMAL currency units (e.g. 42.50 = $42.50), never minor units (cents).
|
|
5827
6155
|
\u2022 Billing mode is decided server-side: pay_per_call needs a PAID --payment-order-id (from
|
|
5828
6156
|
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
|
|
6157
|
+
\u2022 Write verbs (book / cancel / update) require --idempotency-key; reuse the SAME key when
|
|
6158
|
+
retrying the same intent.
|
|
6159
|
+
\u2022 update changes ONLY the fields you pass. Trip-side and passenger-side changes are two separate
|
|
6160
|
+
upstream calls with no transaction: the response reports ride_updated / passenger_updated, and a
|
|
6161
|
+
partial application returns UPSTREAM_ERROR with data.partial_update \u2014 re-issue update for the
|
|
6162
|
+
failed side only.`
|
|
5831
6163
|
);
|
|
5832
6164
|
registerQuoteCommand(rideCmd, deps);
|
|
5833
6165
|
registerBookCommand(rideCmd, deps);
|
|
5834
6166
|
registerRideGetCommand(rideCmd, deps);
|
|
5835
6167
|
registerCancelCommand(rideCmd, deps);
|
|
6168
|
+
registerRideUpdateCommand(rideCmd, deps);
|
|
6169
|
+
registerRideTripStatusCommand(rideCmd, deps);
|
|
5836
6170
|
registerListOrdersCommand(rideCmd, deps);
|
|
5837
6171
|
const servicesCmd = program.command("services").description("Merchant service discovery");
|
|
5838
6172
|
registerServicesListCommand(servicesCmd, { discoveryClient, program });
|