@agenzo/merchant-cli 0.8.10 → 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 +502 -156
- 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
|
}
|
|
@@ -3588,6 +3904,9 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3588
3904
|
).option(
|
|
3589
3905
|
"--payment-token-id <id>",
|
|
3590
3906
|
"UPI Agent Pay: payment token id from an already-completed UnionPay network-token capture. When set, the platform skips EVO preauth/capture and only locks the order + records this credential (funds already charged)."
|
|
3907
|
+
).option(
|
|
3908
|
+
"--authorized-merchant-trans-id <id>",
|
|
3909
|
+
"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)."
|
|
3591
3910
|
).option("--member <id>", MEMBER_OPTION_DESCRIPTION).option(
|
|
3592
3911
|
"--idempotency-key <key>",
|
|
3593
3912
|
"Idempotency key forwarded verbatim as the Idempotency-Key header"
|
|
@@ -3601,18 +3920,18 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3601
3920
|
message: "API Key:",
|
|
3602
3921
|
type: "password"
|
|
3603
3922
|
});
|
|
3604
|
-
const productToken =
|
|
3605
|
-
const totalAmount =
|
|
3606
|
-
const currency =
|
|
3607
|
-
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"));
|
|
3608
3927
|
const checkIn = stayDate3(opts.checkIn, "check-in");
|
|
3609
3928
|
const checkOut = stayDate3(opts.checkOut, "check-out");
|
|
3610
3929
|
if (!(checkOut > checkIn)) {
|
|
3611
3930
|
throw new CliError("PARAM_INVALID", "--check-out must be strictly after --check-in.");
|
|
3612
3931
|
}
|
|
3613
|
-
const guestName =
|
|
3614
|
-
const contactName =
|
|
3615
|
-
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");
|
|
3616
3935
|
const body = {
|
|
3617
3936
|
product_token: productToken,
|
|
3618
3937
|
total_amount: totalAmount,
|
|
@@ -3620,9 +3939,9 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3620
3939
|
price_items: priceItems,
|
|
3621
3940
|
check_in: checkIn,
|
|
3622
3941
|
check_out: checkOut,
|
|
3623
|
-
room_num:
|
|
3624
|
-
adults:
|
|
3625
|
-
children:
|
|
3942
|
+
room_num: num6(opts.roomNum, "room-num"),
|
|
3943
|
+
adults: num6(opts.adults, "adults"),
|
|
3944
|
+
children: num6(opts.children, "children"),
|
|
3626
3945
|
nationality: opts.nationality,
|
|
3627
3946
|
guest_name: guestName,
|
|
3628
3947
|
contact_name: contactName,
|
|
@@ -3639,11 +3958,14 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3639
3958
|
if (opts.bedType !== void 0) body.bed_type = opts.bedType;
|
|
3640
3959
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
3641
3960
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
3961
|
+
if (opts.authorizedMerchantTransId) {
|
|
3962
|
+
body.authorized_merchant_trans_id = opts.authorizedMerchantTransId;
|
|
3963
|
+
}
|
|
3642
3964
|
const member = memberIdOf(opts);
|
|
3643
3965
|
if (member !== void 0) body.member_id = member;
|
|
3644
3966
|
if (!isYes) {
|
|
3645
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.";
|
|
3646
|
-
const confirmed = await
|
|
3968
|
+
const confirmed = await confirm4({
|
|
3647
3969
|
message: `Create this hotel order for ${totalAmount} ${currency} (check-in ${checkIn}, check-out ${checkOut})? ${chargeNote}`,
|
|
3648
3970
|
default: false
|
|
3649
3971
|
});
|
|
@@ -3677,7 +3999,7 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3677
3999
|
}
|
|
3678
4000
|
|
|
3679
4001
|
// src/hotel-redaug/pay-order.ts
|
|
3680
|
-
import { confirm as
|
|
4002
|
+
import { confirm as confirm5 } from "@inquirer/prompts";
|
|
3681
4003
|
|
|
3682
4004
|
// src/hotel-redaug/watch.ts
|
|
3683
4005
|
var DEFAULT_ORDER_WATCH_INTERVAL_SECONDS = 5;
|
|
@@ -3853,7 +4175,7 @@ function registerHotelPayOrderCommand(parent, deps) {
|
|
|
3853
4175
|
const watchTimeout = resolveSeconds(opts.watchTimeout, DEFAULT_PAY_WATCH_TIMEOUT_SECONDS);
|
|
3854
4176
|
const body = {};
|
|
3855
4177
|
if (!isYes) {
|
|
3856
|
-
const confirmed = await
|
|
4178
|
+
const confirmed = await confirm5({
|
|
3857
4179
|
message: `Settle hotel order ${orderId}? This moves money via the order's configured billing mode (monthly_settlement or pay_per_call).`,
|
|
3858
4180
|
default: false
|
|
3859
4181
|
});
|
|
@@ -3931,7 +4253,7 @@ function registerHotelPayOrderCommand(parent, deps) {
|
|
|
3931
4253
|
}
|
|
3932
4254
|
|
|
3933
4255
|
// src/hotel-redaug/get.ts
|
|
3934
|
-
function
|
|
4256
|
+
function need10(value, flag) {
|
|
3935
4257
|
if (value === void 0) {
|
|
3936
4258
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
3937
4259
|
}
|
|
@@ -3995,7 +4317,7 @@ function registerHotelGetCommand(parent, deps) {
|
|
|
3995
4317
|
message: "API Key:",
|
|
3996
4318
|
type: "password"
|
|
3997
4319
|
});
|
|
3998
|
-
const orderId =
|
|
4320
|
+
const orderId = need10(opts.orderId, "order-id");
|
|
3999
4321
|
if (opts.watch) {
|
|
4000
4322
|
await watchOrderStatus(deps.apiClient, apiKey, orderId, {
|
|
4001
4323
|
intervalSeconds: resolveSeconds(
|
|
@@ -4029,7 +4351,7 @@ function registerHotelGetCommand(parent, deps) {
|
|
|
4029
4351
|
}
|
|
4030
4352
|
|
|
4031
4353
|
// src/hotel-redaug/cancel.ts
|
|
4032
|
-
function
|
|
4354
|
+
function need11(value, flag) {
|
|
4033
4355
|
if (value === void 0) {
|
|
4034
4356
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4035
4357
|
}
|
|
@@ -4082,8 +4404,8 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
4082
4404
|
message: "API Key:",
|
|
4083
4405
|
type: "password"
|
|
4084
4406
|
});
|
|
4085
|
-
const orderId =
|
|
4086
|
-
const fcOrderCode =
|
|
4407
|
+
const orderId = need11(opts.orderId, "order-id");
|
|
4408
|
+
const fcOrderCode = need11(opts.fcOrderCode, "fc-order-code");
|
|
4087
4409
|
const body = { fc_order_code: fcOrderCode };
|
|
4088
4410
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
4089
4411
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -4112,15 +4434,15 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
4112
4434
|
}
|
|
4113
4435
|
|
|
4114
4436
|
// src/hotel-redaug/checkout.ts
|
|
4115
|
-
import { confirm as
|
|
4116
|
-
function
|
|
4437
|
+
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
4438
|
+
function need12(value, flag) {
|
|
4117
4439
|
if (value === void 0) {
|
|
4118
4440
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4119
4441
|
}
|
|
4120
4442
|
return value;
|
|
4121
4443
|
}
|
|
4122
|
-
function
|
|
4123
|
-
const n = Number(
|
|
4444
|
+
function num7(value, flag) {
|
|
4445
|
+
const n = Number(need12(value, flag));
|
|
4124
4446
|
if (!Number.isFinite(n)) {
|
|
4125
4447
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4126
4448
|
}
|
|
@@ -4186,11 +4508,11 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
4186
4508
|
message: "API Key:",
|
|
4187
4509
|
type: "password"
|
|
4188
4510
|
});
|
|
4189
|
-
const orderId =
|
|
4190
|
-
const fcOrderCode =
|
|
4191
|
-
const reason =
|
|
4192
|
-
const checkoutRooms = parseCheckoutRooms(
|
|
4193
|
-
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");
|
|
4194
4516
|
const body = {
|
|
4195
4517
|
fc_order_code: fcOrderCode,
|
|
4196
4518
|
reason,
|
|
@@ -4198,7 +4520,7 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
4198
4520
|
checkout_rooms: checkoutRooms
|
|
4199
4521
|
};
|
|
4200
4522
|
if (!isYes) {
|
|
4201
|
-
const confirmed = await
|
|
4523
|
+
const confirmed = await confirm6({
|
|
4202
4524
|
message: `Request check-out / out-of-policy cancellation for order ${orderId} (${checkoutRooms.length} room(s))? The property must approve and charges may apply.`,
|
|
4203
4525
|
default: false
|
|
4204
4526
|
});
|
|
@@ -4232,7 +4554,7 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
4232
4554
|
}
|
|
4233
4555
|
|
|
4234
4556
|
// src/hotel-redaug/get-checkout.ts
|
|
4235
|
-
function
|
|
4557
|
+
function need13(value, flag) {
|
|
4236
4558
|
if (value === void 0) {
|
|
4237
4559
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4238
4560
|
}
|
|
@@ -4268,7 +4590,7 @@ function registerHotelGetCheckoutCommand(parent, deps) {
|
|
|
4268
4590
|
message: "API Key:",
|
|
4269
4591
|
type: "password"
|
|
4270
4592
|
});
|
|
4271
|
-
const taskOrderCode =
|
|
4593
|
+
const taskOrderCode = need13(opts.taskOrderCode, "task-order-code");
|
|
4272
4594
|
if (opts.watch) {
|
|
4273
4595
|
await watchCheckoutStatus(deps.apiClient, apiKey, taskOrderCode, {
|
|
4274
4596
|
intervalSeconds: resolveSeconds(
|
|
@@ -4372,7 +4694,7 @@ function registerHotelListOrdersCommand(parent, deps) {
|
|
|
4372
4694
|
}
|
|
4373
4695
|
|
|
4374
4696
|
// src/hotel-redaug/find-destination.ts
|
|
4375
|
-
function
|
|
4697
|
+
function need14(value, flag) {
|
|
4376
4698
|
if (value === void 0 || value.trim() === "") {
|
|
4377
4699
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4378
4700
|
}
|
|
@@ -4406,7 +4728,7 @@ function registerHotelFindDestinationCommand(parent, deps) {
|
|
|
4406
4728
|
message: "API Key:",
|
|
4407
4729
|
type: "password"
|
|
4408
4730
|
});
|
|
4409
|
-
const keyword =
|
|
4731
|
+
const keyword = need14(opts.keyword, "keyword");
|
|
4410
4732
|
const body = { keyword };
|
|
4411
4733
|
if (opts.dataType !== void 0) {
|
|
4412
4734
|
body.data_type = opts.dataType;
|
|
@@ -4430,21 +4752,21 @@ function registerHotelFindDestinationCommand(parent, deps) {
|
|
|
4430
4752
|
}
|
|
4431
4753
|
|
|
4432
4754
|
// src/hotel-redaug/hotel-filters.ts
|
|
4433
|
-
function
|
|
4755
|
+
function need15(value, flag) {
|
|
4434
4756
|
if (value === void 0 || value.trim() === "") {
|
|
4435
4757
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4436
4758
|
}
|
|
4437
4759
|
return value;
|
|
4438
4760
|
}
|
|
4439
|
-
function
|
|
4440
|
-
const n = Number(
|
|
4761
|
+
function num8(value, flag) {
|
|
4762
|
+
const n = Number(need15(value, flag));
|
|
4441
4763
|
if (!Number.isFinite(n)) {
|
|
4442
4764
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4443
4765
|
}
|
|
4444
4766
|
return n;
|
|
4445
4767
|
}
|
|
4446
4768
|
function coord2(value, flag, min, max) {
|
|
4447
|
-
const n =
|
|
4769
|
+
const n = num8(value, flag);
|
|
4448
4770
|
if (n < min || n > max) {
|
|
4449
4771
|
throw new CliError("PARAM_INVALID", `--${flag} must be between ${min} and ${max}.`);
|
|
4450
4772
|
}
|
|
@@ -4517,12 +4839,12 @@ function registerHotelFiltersCommand(parent, deps) {
|
|
|
4517
4839
|
}
|
|
4518
4840
|
const body = {};
|
|
4519
4841
|
if (hasDestination) {
|
|
4520
|
-
body.destination_id =
|
|
4842
|
+
body.destination_id = need15(opts.destinationId, "destination-id");
|
|
4521
4843
|
} else {
|
|
4522
4844
|
body.lat = coord2(opts.lat, "lat", -90, 90);
|
|
4523
4845
|
body.lng = coord2(opts.lng, "lng", -180, 180);
|
|
4524
4846
|
}
|
|
4525
|
-
body.distance =
|
|
4847
|
+
body.distance = num8(opts.distance, "distance");
|
|
4526
4848
|
const result = await deps.apiClient.post(
|
|
4527
4849
|
"/hotel/filters",
|
|
4528
4850
|
{ type: "api-key", key: apiKey },
|
|
@@ -4542,7 +4864,7 @@ function registerHotelFiltersCommand(parent, deps) {
|
|
|
4542
4864
|
}
|
|
4543
4865
|
|
|
4544
4866
|
// src/hotel-redaug/list-cities.ts
|
|
4545
|
-
function
|
|
4867
|
+
function need16(value, flag) {
|
|
4546
4868
|
if (value === void 0 || value.trim() === "") {
|
|
4547
4869
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4548
4870
|
}
|
|
@@ -4575,7 +4897,7 @@ function registerHotelListCitiesCommand(parent, deps) {
|
|
|
4575
4897
|
message: "API Key:",
|
|
4576
4898
|
type: "password"
|
|
4577
4899
|
});
|
|
4578
|
-
const country =
|
|
4900
|
+
const country = need16(opts.country, "country");
|
|
4579
4901
|
const body = { country_code: country };
|
|
4580
4902
|
const result = await deps.apiClient.post(
|
|
4581
4903
|
"/hotel/cities",
|
|
@@ -4596,7 +4918,7 @@ function registerHotelListCitiesCommand(parent, deps) {
|
|
|
4596
4918
|
}
|
|
4597
4919
|
|
|
4598
4920
|
// src/hotel-redaug/hotel-detail.ts
|
|
4599
|
-
function
|
|
4921
|
+
function need17(value, flag) {
|
|
4600
4922
|
if (value === void 0 || value.trim() === "") {
|
|
4601
4923
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4602
4924
|
}
|
|
@@ -4743,7 +5065,7 @@ function registerHotelDetailCommand(parent, deps) {
|
|
|
4743
5065
|
message: "API Key:",
|
|
4744
5066
|
type: "password"
|
|
4745
5067
|
});
|
|
4746
|
-
const hotelId =
|
|
5068
|
+
const hotelId = need17(opts.hotelId, "hotel-id");
|
|
4747
5069
|
const rawWithImages = opts.withImages;
|
|
4748
5070
|
const withImages = rawWithImages !== "false" && rawWithImages !== false;
|
|
4749
5071
|
const settings = parseSettings(opts.settings);
|
|
@@ -4951,14 +5273,14 @@ function registerHotelSkillCommand(parent) {
|
|
|
4951
5273
|
}
|
|
4952
5274
|
|
|
4953
5275
|
// src/flight-flink/_helpers.ts
|
|
4954
|
-
function
|
|
5276
|
+
function need18(value, flag) {
|
|
4955
5277
|
if (value === void 0) {
|
|
4956
5278
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
4957
5279
|
}
|
|
4958
5280
|
return value;
|
|
4959
5281
|
}
|
|
4960
|
-
function
|
|
4961
|
-
const n = Number(
|
|
5282
|
+
function num9(value, flag) {
|
|
5283
|
+
const n = Number(need18(value, flag));
|
|
4962
5284
|
if (!Number.isFinite(n)) {
|
|
4963
5285
|
throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
|
|
4964
5286
|
}
|
|
@@ -4993,7 +5315,7 @@ function registerFindAirportCommand(parent, deps) {
|
|
|
4993
5315
|
const opts = cmd.optsWithGlobals();
|
|
4994
5316
|
const format = resolveFormat(opts.format);
|
|
4995
5317
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
4996
|
-
const keyword =
|
|
5318
|
+
const keyword = need18(opts.keyword, "keyword");
|
|
4997
5319
|
const spinner = format === "json" ? null : createSpinner("Resolving airports...");
|
|
4998
5320
|
const result = await deps.apiClient.post(
|
|
4999
5321
|
"/flight/find-airport",
|
|
@@ -5019,8 +5341,8 @@ function registerListAirportsCommand(parent, deps) {
|
|
|
5019
5341
|
const format = resolveFormat(opts.format);
|
|
5020
5342
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5021
5343
|
const body = {
|
|
5022
|
-
page:
|
|
5023
|
-
page_size:
|
|
5344
|
+
page: num9(opts.page, "page"),
|
|
5345
|
+
page_size: num9(opts.pageSize, "page-size")
|
|
5024
5346
|
};
|
|
5025
5347
|
if (opts.keyword !== void 0) body.keyword = opts.keyword;
|
|
5026
5348
|
const spinner = format === "json" ? null : createSpinner("Fetching airports...");
|
|
@@ -5044,8 +5366,8 @@ function registerListAirlinesCommand(parent, deps) {
|
|
|
5044
5366
|
const format = resolveFormat(opts.format);
|
|
5045
5367
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5046
5368
|
const body = {
|
|
5047
|
-
page:
|
|
5048
|
-
page_size:
|
|
5369
|
+
page: num9(opts.page, "page"),
|
|
5370
|
+
page_size: num9(opts.pageSize, "page-size")
|
|
5049
5371
|
};
|
|
5050
5372
|
if (opts.keyword !== void 0) body.keyword = opts.keyword;
|
|
5051
5373
|
const spinner = format === "json" ? null : createSpinner("Fetching airlines...");
|
|
@@ -5089,13 +5411,13 @@ function registerSearchCommand(parent, deps) {
|
|
|
5089
5411
|
const format = resolveFormat(opts.format);
|
|
5090
5412
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5091
5413
|
const body = {
|
|
5092
|
-
trip_type:
|
|
5093
|
-
journeys: jsonArray(
|
|
5414
|
+
trip_type: num9(opts.tripType, "trip-type"),
|
|
5415
|
+
journeys: jsonArray(need18(opts.journeys, "journeys"), "journeys"),
|
|
5094
5416
|
cabin_class: opts.cabinClass,
|
|
5095
|
-
adult_num:
|
|
5096
|
-
child_num:
|
|
5097
|
-
infant_num:
|
|
5098
|
-
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")
|
|
5099
5421
|
};
|
|
5100
5422
|
if (opts.airline !== void 0) body.airline = opts.airline;
|
|
5101
5423
|
if (opts.journeyId !== void 0) {
|
|
@@ -5121,7 +5443,7 @@ function registerMoreOffersCommand(parent, deps) {
|
|
|
5121
5443
|
const opts = cmd.optsWithGlobals();
|
|
5122
5444
|
const format = resolveFormat(opts.format);
|
|
5123
5445
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5124
|
-
const productToken =
|
|
5446
|
+
const productToken = need18(opts.productToken, "product-token");
|
|
5125
5447
|
const spinner = format === "json" ? null : createSpinner("Fetching offers...");
|
|
5126
5448
|
const result = await deps.apiClient.post(
|
|
5127
5449
|
"/flight/more-offers",
|
|
@@ -5142,7 +5464,7 @@ function registerVerifyCommand(parent, deps) {
|
|
|
5142
5464
|
const opts = cmd.optsWithGlobals();
|
|
5143
5465
|
const format = resolveFormat(opts.format);
|
|
5144
5466
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5145
|
-
const productToken =
|
|
5467
|
+
const productToken = need18(opts.productToken, "product-token");
|
|
5146
5468
|
const spinner = format === "json" ? null : createSpinner("Verifying price...");
|
|
5147
5469
|
const result = await deps.apiClient.post(
|
|
5148
5470
|
"/flight/verify",
|
|
@@ -5164,35 +5486,41 @@ function registerVerifyCommand(parent, deps) {
|
|
|
5164
5486
|
}
|
|
5165
5487
|
|
|
5166
5488
|
// src/flight-flink/create-order.ts
|
|
5167
|
-
import { confirm as
|
|
5489
|
+
import { confirm as confirm7 } from "@inquirer/prompts";
|
|
5168
5490
|
function registerCreateOrderCommand(parent, deps) {
|
|
5169
|
-
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(
|
|
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(
|
|
5492
|
+
"--authorized-merchant-trans-id <id>",
|
|
5493
|
+
"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)."
|
|
5494
|
+
).option("--member <id>", MEMBER_OPTION_DESCRIPTION).option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5170
5495
|
attachSchemaHelp(cmd, flightCreateOrderSchema);
|
|
5171
5496
|
cmd.action(async () => {
|
|
5172
5497
|
const opts = cmd.optsWithGlobals();
|
|
5173
5498
|
const format = resolveFormat(opts.format);
|
|
5174
5499
|
const isYes = Boolean(opts.yes);
|
|
5175
5500
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5176
|
-
const productToken =
|
|
5177
|
-
const totalAmount =
|
|
5178
|
-
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");
|
|
5179
5504
|
const body = {
|
|
5180
5505
|
product_token: productToken,
|
|
5181
5506
|
total_amount: totalAmount,
|
|
5182
5507
|
currency,
|
|
5183
|
-
trip_type:
|
|
5184
|
-
contact_name:
|
|
5185
|
-
contact_region:
|
|
5186
|
-
contact_phone:
|
|
5187
|
-
contact_email:
|
|
5188
|
-
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")
|
|
5189
5514
|
};
|
|
5190
5515
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5191
5516
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
5517
|
+
if (opts.authorizedMerchantTransId) {
|
|
5518
|
+
body.authorized_merchant_trans_id = opts.authorizedMerchantTransId;
|
|
5519
|
+
}
|
|
5192
5520
|
const member = memberIdOf(opts);
|
|
5193
5521
|
if (member !== void 0) body.member_id = member;
|
|
5194
5522
|
if (!isYes) {
|
|
5195
|
-
const ok = await
|
|
5523
|
+
const ok = await confirm7({
|
|
5196
5524
|
message: `Create this flight order for ${totalAmount} ${currency}? This locks the fare but does NOT charge yet.`,
|
|
5197
5525
|
default: false
|
|
5198
5526
|
});
|
|
@@ -5231,18 +5559,21 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
5231
5559
|
}
|
|
5232
5560
|
|
|
5233
5561
|
// src/flight-flink/pay-order.ts
|
|
5234
|
-
import { confirm as
|
|
5562
|
+
import { confirm as confirm8 } from "@inquirer/prompts";
|
|
5235
5563
|
function registerPayOrderCommand(parent, deps) {
|
|
5236
|
-
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");
|
|
5237
5568
|
attachSchemaHelp(cmd, flightPayOrderSchema);
|
|
5238
5569
|
cmd.action(async () => {
|
|
5239
5570
|
const opts = cmd.optsWithGlobals();
|
|
5240
5571
|
const format = resolveFormat(opts.format);
|
|
5241
5572
|
const isYes = Boolean(opts.yes);
|
|
5242
5573
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5243
|
-
const orderNo =
|
|
5574
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5244
5575
|
if (!isYes) {
|
|
5245
|
-
const ok = await
|
|
5576
|
+
const ok = await confirm8({
|
|
5246
5577
|
message: `Pay and ticket order ${orderNo}? This settles the order and issues tickets.`,
|
|
5247
5578
|
default: false
|
|
5248
5579
|
});
|
|
@@ -5253,10 +5584,16 @@ function registerPayOrderCommand(parent, deps) {
|
|
|
5253
5584
|
commandPath: "flight-flink pay-order"
|
|
5254
5585
|
});
|
|
5255
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
|
+
}
|
|
5256
5593
|
const result = await deps.apiClient.post(
|
|
5257
5594
|
`/flight/${encodeURIComponent(orderNo)}/pay`,
|
|
5258
5595
|
{ type: "api-key", key: apiKey },
|
|
5259
|
-
|
|
5596
|
+
body,
|
|
5260
5597
|
{ "Idempotency-Key": idempotencyKey }
|
|
5261
5598
|
);
|
|
5262
5599
|
spinner?.stop();
|
|
@@ -5285,12 +5622,12 @@ function registerGetOrderCommand(parent, deps) {
|
|
|
5285
5622
|
const opts = cmd.optsWithGlobals();
|
|
5286
5623
|
const format = resolveFormat(opts.format);
|
|
5287
5624
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5288
|
-
const orderNo =
|
|
5625
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5289
5626
|
const path = `/flight/${encodeURIComponent(orderNo)}/status`;
|
|
5290
5627
|
const auth = { type: "api-key", key: apiKey };
|
|
5291
5628
|
if (opts.watch) {
|
|
5292
|
-
const interval =
|
|
5293
|
-
const timeoutMs =
|
|
5629
|
+
const interval = num9(opts.watchInterval, "watch-interval") * 1e3;
|
|
5630
|
+
const timeoutMs = num9(opts.watchTimeout, "watch-timeout") * 1e3;
|
|
5294
5631
|
const deadline = Date.now() + timeoutMs;
|
|
5295
5632
|
for (; ; ) {
|
|
5296
5633
|
const r = await deps.apiClient.get(path, auth);
|
|
@@ -5325,7 +5662,7 @@ function registerGetOrderCommand(parent, deps) {
|
|
|
5325
5662
|
}
|
|
5326
5663
|
|
|
5327
5664
|
// src/flight-flink/cancel-order.ts
|
|
5328
|
-
import { confirm as
|
|
5665
|
+
import { confirm as confirm9 } from "@inquirer/prompts";
|
|
5329
5666
|
function registerCancelOrderCommand(parent, deps) {
|
|
5330
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");
|
|
5331
5668
|
attachSchemaHelp(cmd, flightCancelOrderSchema);
|
|
@@ -5334,9 +5671,9 @@ function registerCancelOrderCommand(parent, deps) {
|
|
|
5334
5671
|
const format = resolveFormat(opts.format);
|
|
5335
5672
|
const isYes = Boolean(opts.yes);
|
|
5336
5673
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5337
|
-
const orderNo =
|
|
5674
|
+
const orderNo = need18(opts.orderNo, "order-no");
|
|
5338
5675
|
if (!isYes) {
|
|
5339
|
-
const ok = await
|
|
5676
|
+
const ok = await confirm9({
|
|
5340
5677
|
message: `Cancel order ${orderNo}? This requests cancellation and a refund.`,
|
|
5341
5678
|
default: false
|
|
5342
5679
|
});
|
|
@@ -5381,8 +5718,8 @@ function registerListOrdersCommand2(parent, deps) {
|
|
|
5381
5718
|
if (opts.status !== void 0) params.set("status", opts.status);
|
|
5382
5719
|
const member = memberIdOf(opts);
|
|
5383
5720
|
if (member !== void 0) params.set("member_id", member);
|
|
5384
|
-
params.set("page", String(
|
|
5385
|
-
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")));
|
|
5386
5723
|
const spinner = format === "json" ? null : createSpinner("Fetching flight orders...");
|
|
5387
5724
|
const result = await deps.apiClient.get(
|
|
5388
5725
|
`/flight/orders?${params.toString()}`,
|
|
@@ -5410,10 +5747,10 @@ function registerChangeSearchCommand(parent, deps) {
|
|
|
5410
5747
|
const format = resolveFormat(opts.format);
|
|
5411
5748
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5412
5749
|
const body = {
|
|
5413
|
-
order_no:
|
|
5414
|
-
date:
|
|
5415
|
-
passenger:
|
|
5416
|
-
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"),
|
|
5417
5754
|
cabin_class: opts.cabinClass
|
|
5418
5755
|
};
|
|
5419
5756
|
const spinner = format === "json" ? null : createSpinner("Searching change options...");
|
|
@@ -5429,7 +5766,7 @@ function registerChangeSearchCommand(parent, deps) {
|
|
|
5429
5766
|
}
|
|
5430
5767
|
|
|
5431
5768
|
// src/flight-flink/change-apply.ts
|
|
5432
|
-
import { confirm as
|
|
5769
|
+
import { confirm as confirm10 } from "@inquirer/prompts";
|
|
5433
5770
|
function registerChangeApplyCommand(parent, deps) {
|
|
5434
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");
|
|
5435
5772
|
attachSchemaHelp(cmd, flightChangeApplySchema);
|
|
@@ -5439,17 +5776,17 @@ function registerChangeApplyCommand(parent, deps) {
|
|
|
5439
5776
|
const isYes = Boolean(opts.yes);
|
|
5440
5777
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5441
5778
|
const body = {
|
|
5442
|
-
order_no:
|
|
5443
|
-
passenger:
|
|
5444
|
-
segment_id:
|
|
5445
|
-
product_token:
|
|
5446
|
-
contact_name:
|
|
5447
|
-
contact_region:
|
|
5448
|
-
contact_phone:
|
|
5449
|
-
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")
|
|
5450
5787
|
};
|
|
5451
5788
|
if (!isYes) {
|
|
5452
|
-
const ok = await
|
|
5789
|
+
const ok = await confirm10({
|
|
5453
5790
|
message: `Submit a change request for order ${body.order_no}?`,
|
|
5454
5791
|
default: false
|
|
5455
5792
|
});
|
|
@@ -5480,7 +5817,7 @@ function registerChangeDetailCommand(parent, deps) {
|
|
|
5480
5817
|
const opts = cmd.optsWithGlobals();
|
|
5481
5818
|
const format = resolveFormat(opts.format);
|
|
5482
5819
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5483
|
-
const changeOrderNo =
|
|
5820
|
+
const changeOrderNo = need18(opts.changeOrderNo, "change-order-no");
|
|
5484
5821
|
const spinner = format === "json" ? null : createSpinner("Fetching change detail...");
|
|
5485
5822
|
const result = await deps.apiClient.get(
|
|
5486
5823
|
`/flight/change/${encodeURIComponent(changeOrderNo)}`,
|
|
@@ -5493,7 +5830,7 @@ function registerChangeDetailCommand(parent, deps) {
|
|
|
5493
5830
|
}
|
|
5494
5831
|
|
|
5495
5832
|
// src/flight-flink/change-cancel.ts
|
|
5496
|
-
import { confirm as
|
|
5833
|
+
import { confirm as confirm11 } from "@inquirer/prompts";
|
|
5497
5834
|
function registerChangeCancelCommand(parent, deps) {
|
|
5498
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");
|
|
5499
5836
|
attachSchemaHelp(cmd, flightChangeCancelSchema);
|
|
@@ -5502,9 +5839,9 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5502
5839
|
const format = resolveFormat(opts.format);
|
|
5503
5840
|
const isYes = Boolean(opts.yes);
|
|
5504
5841
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5505
|
-
const changeOrderNo =
|
|
5842
|
+
const changeOrderNo = need18(opts.changeOrderNo, "change-order-no");
|
|
5506
5843
|
if (!isYes) {
|
|
5507
|
-
const ok = await
|
|
5844
|
+
const ok = await confirm11({ message: `Cancel change request ${changeOrderNo}?`, default: false });
|
|
5508
5845
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Change cancellation aborted by user.");
|
|
5509
5846
|
}
|
|
5510
5847
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5525,7 +5862,7 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5525
5862
|
}
|
|
5526
5863
|
|
|
5527
5864
|
// src/flight-flink/change-pay.ts
|
|
5528
|
-
import { confirm as
|
|
5865
|
+
import { confirm as confirm12 } from "@inquirer/prompts";
|
|
5529
5866
|
function registerChangePayCommand(parent, deps) {
|
|
5530
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");
|
|
5531
5868
|
attachSchemaHelp(cmd, flightChangePaySchema);
|
|
@@ -5534,10 +5871,10 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5534
5871
|
const format = resolveFormat(opts.format);
|
|
5535
5872
|
const isYes = Boolean(opts.yes);
|
|
5536
5873
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5537
|
-
const changeOrderNo =
|
|
5538
|
-
const orderNo =
|
|
5539
|
-
const amount =
|
|
5540
|
-
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");
|
|
5541
5878
|
const body = {
|
|
5542
5879
|
order_no: orderNo,
|
|
5543
5880
|
amount,
|
|
@@ -5546,7 +5883,7 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5546
5883
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5547
5884
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
5548
5885
|
if (!isYes) {
|
|
5549
|
-
const ok = await
|
|
5886
|
+
const ok = await confirm12({
|
|
5550
5887
|
message: `Pay change fee ${amount} ${currency} for change order ${changeOrderNo}? This charges the customer and triggers change ticketing.`,
|
|
5551
5888
|
default: false
|
|
5552
5889
|
});
|
|
@@ -5582,7 +5919,7 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5582
5919
|
}
|
|
5583
5920
|
|
|
5584
5921
|
// src/flight-flink/refund-apply.ts
|
|
5585
|
-
import { confirm as
|
|
5922
|
+
import { confirm as confirm13 } from "@inquirer/prompts";
|
|
5586
5923
|
function registerRefundApplyCommand(parent, deps) {
|
|
5587
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");
|
|
5588
5925
|
attachSchemaHelp(cmd, flightRefundApplySchema);
|
|
@@ -5592,18 +5929,18 @@ function registerRefundApplyCommand(parent, deps) {
|
|
|
5592
5929
|
const isYes = Boolean(opts.yes);
|
|
5593
5930
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5594
5931
|
const body = {
|
|
5595
|
-
order_no:
|
|
5596
|
-
passenger:
|
|
5597
|
-
segment_id:
|
|
5598
|
-
reason_type:
|
|
5599
|
-
contact_name:
|
|
5600
|
-
contact_region:
|
|
5601
|
-
contact_phone:
|
|
5602
|
-
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")
|
|
5603
5940
|
};
|
|
5604
5941
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
5605
5942
|
if (!isYes) {
|
|
5606
|
-
const ok = await
|
|
5943
|
+
const ok = await confirm13({
|
|
5607
5944
|
message: `Submit a refund request for order ${body.order_no}?`,
|
|
5608
5945
|
default: false
|
|
5609
5946
|
});
|
|
@@ -5634,7 +5971,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
5634
5971
|
const opts = cmd.optsWithGlobals();
|
|
5635
5972
|
const format = resolveFormat(opts.format);
|
|
5636
5973
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5637
|
-
const refundOrderNo =
|
|
5974
|
+
const refundOrderNo = need18(opts.refundOrderNo, "refund-order-no");
|
|
5638
5975
|
const spinner = format === "json" ? null : createSpinner("Fetching refund detail...");
|
|
5639
5976
|
const result = await deps.apiClient.get(
|
|
5640
5977
|
`/flight/refund/${encodeURIComponent(refundOrderNo)}`,
|
|
@@ -5647,7 +5984,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
5647
5984
|
}
|
|
5648
5985
|
|
|
5649
5986
|
// src/flight-flink/refund-confirm.ts
|
|
5650
|
-
import { confirm as
|
|
5987
|
+
import { confirm as confirm14 } from "@inquirer/prompts";
|
|
5651
5988
|
function registerRefundConfirmCommand(parent, deps) {
|
|
5652
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");
|
|
5653
5990
|
attachSchemaHelp(cmd, flightRefundConfirmSchema);
|
|
@@ -5656,14 +5993,14 @@ function registerRefundConfirmCommand(parent, deps) {
|
|
|
5656
5993
|
const format = resolveFormat(opts.format);
|
|
5657
5994
|
const isYes = Boolean(opts.yes);
|
|
5658
5995
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5659
|
-
const refundOrderNo =
|
|
5660
|
-
const confirmFlag =
|
|
5996
|
+
const refundOrderNo = need18(opts.refundOrderNo, "refund-order-no");
|
|
5997
|
+
const confirmFlag = need18(opts.confirm, "confirm");
|
|
5661
5998
|
if (confirmFlag !== "1" && confirmFlag !== "2") {
|
|
5662
5999
|
throw new CliError("PARAM_INVALID", '--confirm must be "1" (confirm) or "2" (cancel).');
|
|
5663
6000
|
}
|
|
5664
6001
|
if (!isYes) {
|
|
5665
6002
|
const action = confirmFlag === "1" ? "confirm" : "cancel";
|
|
5666
|
-
const ok = await
|
|
6003
|
+
const ok = await confirm14({ message: `${action} refund ${refundOrderNo}?`, default: false });
|
|
5667
6004
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Refund confirmation aborted by user.");
|
|
5668
6005
|
}
|
|
5669
6006
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5793,13 +6130,16 @@ async function main() {
|
|
|
5793
6130
|
process.env.AGENZO_FORMAT = resolveFormat(flag);
|
|
5794
6131
|
});
|
|
5795
6132
|
const rideCmd = program.command("ride-elife").description(
|
|
5796
|
-
`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.
|
|
5797
6134
|
|
|
5798
6135
|
Workflow (typical order):
|
|
5799
6136
|
1. quote Get fare quotes between two points \u2192 vehicle_classes[] each with a quote_id
|
|
5800
6137
|
2. book Book one vehicle_class using its quote_id \u2192 ride_id (write; needs --idempotency-key)
|
|
5801
6138
|
3. get Poll ride status by --order-id=<ride_id> until terminal (or use --watch for NDJSON)
|
|
5802
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
|
|
5803
6143
|
list-orders (standalone) List the developer's previous ride orders
|
|
5804
6144
|
|
|
5805
6145
|
Key notes:
|
|
@@ -5814,13 +6154,19 @@ Key notes:
|
|
|
5814
6154
|
\u2022 All amounts are DECIMAL currency units (e.g. 42.50 = $42.50), never minor units (cents).
|
|
5815
6155
|
\u2022 Billing mode is decided server-side: pay_per_call needs a PAID --payment-order-id (from
|
|
5816
6156
|
payment-cli); monthly_settlement forbids it (settled against the developer's account).
|
|
5817
|
-
\u2022 Write verbs (book / cancel) require --idempotency-key; reuse the SAME key when
|
|
5818
|
-
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.`
|
|
5819
6163
|
);
|
|
5820
6164
|
registerQuoteCommand(rideCmd, deps);
|
|
5821
6165
|
registerBookCommand(rideCmd, deps);
|
|
5822
6166
|
registerRideGetCommand(rideCmd, deps);
|
|
5823
6167
|
registerCancelCommand(rideCmd, deps);
|
|
6168
|
+
registerRideUpdateCommand(rideCmd, deps);
|
|
6169
|
+
registerRideTripStatusCommand(rideCmd, deps);
|
|
5824
6170
|
registerListOrdersCommand(rideCmd, deps);
|
|
5825
6171
|
const servicesCmd = program.command("services").description("Merchant service discovery");
|
|
5826
6172
|
registerServicesListCommand(servicesCmd, { discoveryClient, program });
|