@agenzo/merchant-cli 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/index.js +56 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@agenzo/merchant-cli) [](../../LICENSE) 
|
|
4
4
|
|
|
5
5
|
> **Merchant-fulfillment CLI** for the Agenzo platform — binary `agenzo-merchant-cli`.
|
|
6
|
-
> Agents fulfill commerce services here. Each capability is a noun and the set grows over time — use `services` to discover what's available; today's capabilities are ride-hailing (`ride-elife`)
|
|
6
|
+
> Agents fulfill commerce services here. Each capability is a noun and the set grows over time — use `services` to discover what's available; today's capabilities are ride-hailing (`ride-elife`) and hotel booking (`hotel-redaug`).
|
|
7
7
|
|
|
8
8
|
**[Overview](#overview)** · **[Features](#features)** · **[Quick Start](#quick-start)** · **[Global flags](#global-flags)** · **[Errors](#output-and-error-contract)** · **[Idempotency-Key](#idempotency-key)**
|
|
9
9
|
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
- **`services`** (capability discovery): list what's currently available and how to call it — run this first to learn the current capability set.
|
|
17
17
|
- **`ride-elife`** (ride-hailing): the full loop of quote → book → query/poll → cancel → list-orders.
|
|
18
18
|
- **`hotel-redaug`** (hotel booking): search, find-destination, hotel-filters, list-cities, hotel-detail, quote, create-order, pay-order, get (status/poll), cancel, checkout, get-checkout, list-orders. Supports both **monthly_settlement** (on-account deduction) and **pay_per_call** (user pays via EVO using the order_id as the merchantTransID).
|
|
19
|
-
- **`flight-flink`** (flight booking): search, verify, create-order, pay-order, get-order, cancel, list-orders, and refund operations, including `upi_agent` payment-token passthrough.
|
|
20
19
|
|
|
21
20
|
More fulfillment capabilities are added as new nouns over time; `services list` always reflects the current set.
|
|
22
21
|
|
package/dist/index.js
CHANGED
|
@@ -58,6 +58,7 @@ var CODE_NUM = {
|
|
|
58
58
|
CHECKOUT_NOT_ALLOWED: 4306,
|
|
59
59
|
CHECKOUT_TASK_NOT_FOUND: 4307,
|
|
60
60
|
PAY_PER_CALL_NOT_AVAILABLE: 4308,
|
|
61
|
+
HOTEL_NOT_FOUND: 4309,
|
|
61
62
|
RATE_LIMITED: 5001,
|
|
62
63
|
UPSTREAM_ERROR: 5101,
|
|
63
64
|
INTERNAL_ERROR: 5201,
|
|
@@ -237,6 +238,7 @@ var STABLE_MESSAGE = {
|
|
|
237
238
|
CHECKOUT_NOT_ALLOWED: "A partial check-out is not allowed in the current state.",
|
|
238
239
|
CHECKOUT_TASK_NOT_FOUND: "Check-out application not found.",
|
|
239
240
|
PAY_PER_CALL_NOT_AVAILABLE: "Pay-per-call billing is not available; use monthly_settlement.",
|
|
241
|
+
HOTEL_NOT_FOUND: "This hotel is no longer available from the supplier.",
|
|
240
242
|
NOT_IMPLEMENTED: "This operation is not implemented yet."
|
|
241
243
|
};
|
|
242
244
|
function toErrorEnvelope(error) {
|
|
@@ -1281,6 +1283,12 @@ var hotelCreateOrderSchema = {
|
|
|
1281
1283
|
"contact-email": { type: "string", required: false, description: "Booking contact email" },
|
|
1282
1284
|
"arrive-time": { type: "string", required: false, description: "Expected arrival time", constraints: "HH:mm, hotel local time" },
|
|
1283
1285
|
"special-requests": { type: "string", required: false, description: "Free-text special requests (non-binding)" },
|
|
1286
|
+
tips: { type: "string", required: false, description: "FCG \u5BA2\u6237\u81EA\u6D4B\u70B95 \u63D0\u793A\u4FE1\u606F: the chosen quote rate's tips (tips[].tipsDetails[]) as a JSON array [{title,text}], captured at booking. Stored on the order for the order-detail page only; platform-local, not sent upstream", constraints: "JSON array of {title (string, optional), text (string, optional)}; else PARAM_INVALID" },
|
|
1287
|
+
"bed-type": {
|
|
1288
|
+
type: "string",
|
|
1289
|
+
required: false,
|
|
1290
|
+
description: "Product bed-type code from the chosen quote rate's beds[].code (e.g. 'L000000' King / '1000000' Queen). Forwarded verbatim to upstream createOrder bedType; upstream recommends passing the product-dimension bed type at booking."
|
|
1291
|
+
},
|
|
1284
1292
|
"payment-token-id": {
|
|
1285
1293
|
type: "string",
|
|
1286
1294
|
required: false,
|
|
@@ -1967,8 +1975,6 @@ var flightCreateOrderSchema = flightSchema(
|
|
|
1967
1975
|
"contact-phone": { type: "string", required: true, description: "Contact phone." },
|
|
1968
1976
|
"contact-email": { type: "string", required: true, description: "Contact email." },
|
|
1969
1977
|
passengers: { type: "json", required: true, description: 'JSON array of passengers. gender/id_type are STRINGS ("1"/"2"). child/infant require adult_passenger_name.' },
|
|
1970
|
-
"payment-method-id": { type: "string", required: false, description: "Optional bound-card id (pay_per_call only)." },
|
|
1971
|
-
"payment-token-id": { type: "string", required: false, description: "Optional UPI Agent Pay token id (already-paid credential; skips EVO preauth)." },
|
|
1972
1978
|
"idempotency-key": { type: "string", required: true, description: "Forwarded verbatim as the Idempotency-Key header." }
|
|
1973
1979
|
},
|
|
1974
1980
|
{
|
|
@@ -3331,6 +3337,28 @@ function parsePriceItems(raw) {
|
|
|
3331
3337
|
}
|
|
3332
3338
|
return parsed;
|
|
3333
3339
|
}
|
|
3340
|
+
function parseTips(raw) {
|
|
3341
|
+
const INVALID = "--tips must be a JSON array of {title (string, optional), text (string, optional)}.";
|
|
3342
|
+
let parsed;
|
|
3343
|
+
try {
|
|
3344
|
+
parsed = JSON.parse(raw);
|
|
3345
|
+
} catch {
|
|
3346
|
+
throw new CliError("PARAM_INVALID", INVALID);
|
|
3347
|
+
}
|
|
3348
|
+
if (!Array.isArray(parsed)) {
|
|
3349
|
+
throw new CliError("PARAM_INVALID", INVALID);
|
|
3350
|
+
}
|
|
3351
|
+
for (const el of parsed) {
|
|
3352
|
+
if (typeof el !== "object" || el === null || Array.isArray(el)) {
|
|
3353
|
+
throw new CliError("PARAM_INVALID", INVALID);
|
|
3354
|
+
}
|
|
3355
|
+
const item = el;
|
|
3356
|
+
if (item.title !== void 0 && typeof item.title !== "string" || item.text !== void 0 && typeof item.text !== "string") {
|
|
3357
|
+
throw new CliError("PARAM_INVALID", INVALID);
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
return parsed;
|
|
3361
|
+
}
|
|
3334
3362
|
function need7(value, flag) {
|
|
3335
3363
|
if (value === void 0) {
|
|
3336
3364
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
@@ -3381,7 +3409,13 @@ function formatCreateOrder(data) {
|
|
|
3381
3409
|
return out.join("\n");
|
|
3382
3410
|
}
|
|
3383
3411
|
function registerHotelCreateOrderCommand(parent, deps) {
|
|
3384
|
-
const cmd = parent.command("create-order").description("Create a hotel order without charging (lock inventory, await payment)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--product-token <token>", "Chosen rate token from quote (rates[].product_token)").option("--total-amount <amount>", "Total stay price in decimal currency units (not cents)").option("--currency <currency>", "ISO 4217 currency code from the chosen rate").option("--price-items <json>", "Per-night price breakdown JSON array (copied verbatim from quote)").option("--check-in <date>", "Check-in date (YYYY-MM-DD, match quote)").option("--check-out <date>", "Check-out date (YYYY-MM-DD, strictly after check-in)").option("--room-num <n>", "Number of rooms (match quote)", "1").option("--adults <n>", "Adults per room (match quote)", "2").option("--children <n>", "Children per room (match quote)", "0").option("--nationality <code>", "Guest nationality (ISO country code)", "CN").option("--guest-name <name>", "Primary guest name").option("--contact-name <name>", "Booking contact name (may equal guest-name)").option("--contact-phone <phone>", "Booking contact phone number (digits)").option("--contact-country-code <code>", "Phone country calling code without '+'", "86").option("--contact-email <email>", "Booking contact email").option("--arrive-time <time>", "Expected arrival time (HH:mm, hotel local time)").option("--special-requests <text>", "Free-text special requests (non-binding)").option(
|
|
3412
|
+
const cmd = parent.command("create-order").description("Create a hotel order without charging (lock inventory, await payment)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--product-token <token>", "Chosen rate token from quote (rates[].product_token)").option("--total-amount <amount>", "Total stay price in decimal currency units (not cents)").option("--currency <currency>", "ISO 4217 currency code from the chosen rate").option("--price-items <json>", "Per-night price breakdown JSON array (copied verbatim from quote)").option("--check-in <date>", "Check-in date (YYYY-MM-DD, match quote)").option("--check-out <date>", "Check-out date (YYYY-MM-DD, strictly after check-in)").option("--room-num <n>", "Number of rooms (match quote)", "1").option("--adults <n>", "Adults per room (match quote)", "2").option("--children <n>", "Children per room (match quote)", "0").option("--nationality <code>", "Guest nationality (ISO country code)", "CN").option("--guest-name <name>", "Primary guest name").option("--contact-name <name>", "Booking contact name (may equal guest-name)").option("--contact-phone <phone>", "Booking contact phone number (digits)").option("--contact-country-code <code>", "Phone country calling code without '+'", "86").option("--contact-email <email>", "Booking contact email").option("--arrive-time <time>", "Expected arrival time (HH:mm, hotel local time)").option("--special-requests <text>", "Free-text special requests (non-binding)").option(
|
|
3413
|
+
"--tips <json>",
|
|
3414
|
+
"\u5BA2\u6237\u81EA\u6D4B\u70B95 \u63D0\u793A\u4FE1\u606F: the chosen quote rate's tips as a JSON array [{title,text}]. Stored on the order for the order-detail page ONLY \u2014 platform-local, not sent upstream."
|
|
3415
|
+
).option("--hotel-name <name>", "Hotel name (display-only, stored for order summary)").option(
|
|
3416
|
+
"--bed-type <code>",
|
|
3417
|
+
"Product bed-type code from the chosen quote rate's beds[].code (e.g. 'L000000' King / '1000000' Queen); forwarded verbatim to upstream createOrder bedType."
|
|
3418
|
+
).option(
|
|
3385
3419
|
"--payment-token-id <id>",
|
|
3386
3420
|
"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)."
|
|
3387
3421
|
).option(
|
|
@@ -3428,7 +3462,9 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3428
3462
|
if (opts.contactEmail !== void 0) body.contact_email = opts.contactEmail;
|
|
3429
3463
|
if (opts.arriveTime !== void 0) body.arrive_time = opts.arriveTime;
|
|
3430
3464
|
if (opts.specialRequests !== void 0) body.special_requests = opts.specialRequests;
|
|
3465
|
+
if (opts.tips !== void 0) body.tips = parseTips(opts.tips);
|
|
3431
3466
|
if (opts.hotelName !== void 0) body.hotel_name = opts.hotelName;
|
|
3467
|
+
if (opts.bedType !== void 0) body.bed_type = opts.bedType;
|
|
3432
3468
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
3433
3469
|
if (!isYes) {
|
|
3434
3470
|
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.";
|
|
@@ -3818,7 +3854,6 @@ function registerHotelGetCommand(parent, deps) {
|
|
|
3818
3854
|
}
|
|
3819
3855
|
|
|
3820
3856
|
// src/hotel-redaug/cancel.ts
|
|
3821
|
-
import { confirm as confirm5 } from "@inquirer/prompts";
|
|
3822
3857
|
function need9(value, flag) {
|
|
3823
3858
|
if (value === void 0) {
|
|
3824
3859
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
@@ -3876,15 +3911,6 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
3876
3911
|
const fcOrderCode = need9(opts.fcOrderCode, "fc-order-code");
|
|
3877
3912
|
const body = { fc_order_code: fcOrderCode };
|
|
3878
3913
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
3879
|
-
if (!isYes) {
|
|
3880
|
-
const confirmed = await confirm5({
|
|
3881
|
-
message: `Cancel hotel order ${orderId}? A cancellation fee may apply.`,
|
|
3882
|
-
default: false
|
|
3883
|
-
});
|
|
3884
|
-
if (!confirmed) {
|
|
3885
|
-
throw new CliError("CLIENT_ABORTED", "Cancellation aborted by user.");
|
|
3886
|
-
}
|
|
3887
|
-
}
|
|
3888
3914
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
3889
3915
|
yes: isYes,
|
|
3890
3916
|
commandPath: "hotel-redaug cancel"
|
|
@@ -3911,7 +3937,7 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
3911
3937
|
}
|
|
3912
3938
|
|
|
3913
3939
|
// src/hotel-redaug/checkout.ts
|
|
3914
|
-
import { confirm as
|
|
3940
|
+
import { confirm as confirm5 } from "@inquirer/prompts";
|
|
3915
3941
|
function need10(value, flag) {
|
|
3916
3942
|
if (value === void 0) {
|
|
3917
3943
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
@@ -3997,7 +4023,7 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
3997
4023
|
checkout_rooms: checkoutRooms
|
|
3998
4024
|
};
|
|
3999
4025
|
if (!isYes) {
|
|
4000
|
-
const confirmed = await
|
|
4026
|
+
const confirmed = await confirm5({
|
|
4001
4027
|
message: `Request check-out / out-of-policy cancellation for order ${orderId} (${checkoutRooms.length} room(s))? The property must approve and charges may apply.`,
|
|
4002
4028
|
default: false
|
|
4003
4029
|
});
|
|
@@ -4961,9 +4987,9 @@ function registerVerifyCommand(parent, deps) {
|
|
|
4961
4987
|
}
|
|
4962
4988
|
|
|
4963
4989
|
// src/flight-flink/create-order.ts
|
|
4964
|
-
import { confirm as
|
|
4990
|
+
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
4965
4991
|
function registerCreateOrderCommand(parent, deps) {
|
|
4966
|
-
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("--
|
|
4992
|
+
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("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
4967
4993
|
attachSchemaHelp(cmd, flightCreateOrderSchema);
|
|
4968
4994
|
cmd.action(async () => {
|
|
4969
4995
|
const opts = cmd.optsWithGlobals();
|
|
@@ -4985,9 +5011,8 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
4985
5011
|
passengers: jsonArray(need16(opts.passengers, "passengers"), "passengers")
|
|
4986
5012
|
};
|
|
4987
5013
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
4988
|
-
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
4989
5014
|
if (!isYes) {
|
|
4990
|
-
const ok = await
|
|
5015
|
+
const ok = await confirm6({
|
|
4991
5016
|
message: `Create this flight order for ${totalAmount} ${currency}? This locks the fare but does NOT charge yet.`,
|
|
4992
5017
|
default: false
|
|
4993
5018
|
});
|
|
@@ -5026,7 +5051,7 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
5026
5051
|
}
|
|
5027
5052
|
|
|
5028
5053
|
// src/flight-flink/pay-order.ts
|
|
5029
|
-
import { confirm as
|
|
5054
|
+
import { confirm as confirm7 } from "@inquirer/prompts";
|
|
5030
5055
|
function registerPayOrderCommand(parent, deps) {
|
|
5031
5056
|
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("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5032
5057
|
attachSchemaHelp(cmd, flightPayOrderSchema);
|
|
@@ -5037,7 +5062,7 @@ function registerPayOrderCommand(parent, deps) {
|
|
|
5037
5062
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5038
5063
|
const orderNo = need16(opts.orderNo, "order-no");
|
|
5039
5064
|
if (!isYes) {
|
|
5040
|
-
const ok = await
|
|
5065
|
+
const ok = await confirm7({
|
|
5041
5066
|
message: `Pay and ticket order ${orderNo}? This settles the order and issues tickets.`,
|
|
5042
5067
|
default: false
|
|
5043
5068
|
});
|
|
@@ -5120,7 +5145,7 @@ function registerGetOrderCommand(parent, deps) {
|
|
|
5120
5145
|
}
|
|
5121
5146
|
|
|
5122
5147
|
// src/flight-flink/cancel-order.ts
|
|
5123
|
-
import { confirm as
|
|
5148
|
+
import { confirm as confirm8 } from "@inquirer/prompts";
|
|
5124
5149
|
function registerCancelOrderCommand(parent, deps) {
|
|
5125
5150
|
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");
|
|
5126
5151
|
attachSchemaHelp(cmd, flightCancelOrderSchema);
|
|
@@ -5131,7 +5156,7 @@ function registerCancelOrderCommand(parent, deps) {
|
|
|
5131
5156
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5132
5157
|
const orderNo = need16(opts.orderNo, "order-no");
|
|
5133
5158
|
if (!isYes) {
|
|
5134
|
-
const ok = await
|
|
5159
|
+
const ok = await confirm8({
|
|
5135
5160
|
message: `Cancel order ${orderNo}? This requests cancellation and a refund.`,
|
|
5136
5161
|
default: false
|
|
5137
5162
|
});
|
|
@@ -5222,7 +5247,7 @@ function registerChangeSearchCommand(parent, deps) {
|
|
|
5222
5247
|
}
|
|
5223
5248
|
|
|
5224
5249
|
// src/flight-flink/change-apply.ts
|
|
5225
|
-
import { confirm as
|
|
5250
|
+
import { confirm as confirm9 } from "@inquirer/prompts";
|
|
5226
5251
|
function registerChangeApplyCommand(parent, deps) {
|
|
5227
5252
|
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");
|
|
5228
5253
|
attachSchemaHelp(cmd, flightChangeApplySchema);
|
|
@@ -5242,7 +5267,7 @@ function registerChangeApplyCommand(parent, deps) {
|
|
|
5242
5267
|
contact_email: need16(opts.contactEmail, "contact-email")
|
|
5243
5268
|
};
|
|
5244
5269
|
if (!isYes) {
|
|
5245
|
-
const ok = await
|
|
5270
|
+
const ok = await confirm9({
|
|
5246
5271
|
message: `Submit a change request for order ${body.order_no}?`,
|
|
5247
5272
|
default: false
|
|
5248
5273
|
});
|
|
@@ -5286,7 +5311,7 @@ function registerChangeDetailCommand(parent, deps) {
|
|
|
5286
5311
|
}
|
|
5287
5312
|
|
|
5288
5313
|
// src/flight-flink/change-cancel.ts
|
|
5289
|
-
import { confirm as
|
|
5314
|
+
import { confirm as confirm10 } from "@inquirer/prompts";
|
|
5290
5315
|
function registerChangeCancelCommand(parent, deps) {
|
|
5291
5316
|
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");
|
|
5292
5317
|
attachSchemaHelp(cmd, flightChangeCancelSchema);
|
|
@@ -5297,7 +5322,7 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5297
5322
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5298
5323
|
const changeOrderNo = need16(opts.changeOrderNo, "change-order-no");
|
|
5299
5324
|
if (!isYes) {
|
|
5300
|
-
const ok = await
|
|
5325
|
+
const ok = await confirm10({ message: `Cancel change request ${changeOrderNo}?`, default: false });
|
|
5301
5326
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Change cancellation aborted by user.");
|
|
5302
5327
|
}
|
|
5303
5328
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5318,7 +5343,7 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5318
5343
|
}
|
|
5319
5344
|
|
|
5320
5345
|
// src/flight-flink/refund-apply.ts
|
|
5321
|
-
import { confirm as
|
|
5346
|
+
import { confirm as confirm11 } from "@inquirer/prompts";
|
|
5322
5347
|
function registerRefundApplyCommand(parent, deps) {
|
|
5323
5348
|
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");
|
|
5324
5349
|
attachSchemaHelp(cmd, flightRefundApplySchema);
|
|
@@ -5339,7 +5364,7 @@ function registerRefundApplyCommand(parent, deps) {
|
|
|
5339
5364
|
};
|
|
5340
5365
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
5341
5366
|
if (!isYes) {
|
|
5342
|
-
const ok = await
|
|
5367
|
+
const ok = await confirm11({
|
|
5343
5368
|
message: `Submit a refund request for order ${body.order_no}?`,
|
|
5344
5369
|
default: false
|
|
5345
5370
|
});
|
|
@@ -5383,7 +5408,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
5383
5408
|
}
|
|
5384
5409
|
|
|
5385
5410
|
// src/flight-flink/refund-confirm.ts
|
|
5386
|
-
import { confirm as
|
|
5411
|
+
import { confirm as confirm12 } from "@inquirer/prompts";
|
|
5387
5412
|
function registerRefundConfirmCommand(parent, deps) {
|
|
5388
5413
|
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");
|
|
5389
5414
|
attachSchemaHelp(cmd, flightRefundConfirmSchema);
|
|
@@ -5399,7 +5424,7 @@ function registerRefundConfirmCommand(parent, deps) {
|
|
|
5399
5424
|
}
|
|
5400
5425
|
if (!isYes) {
|
|
5401
5426
|
const action = confirmFlag === "1" ? "confirm" : "cancel";
|
|
5402
|
-
const ok = await
|
|
5427
|
+
const ok = await confirm12({ message: `${action} refund ${refundOrderNo}?`, default: false });
|
|
5403
5428
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Refund confirmation aborted by user.");
|
|
5404
5429
|
}
|
|
5405
5430
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|