@agenzo/merchant-cli 0.8.0 → 0.8.2
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 +58 -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,8 @@ 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,
|
|
62
|
+
BOOKING_RESTRICTED: 4310,
|
|
61
63
|
RATE_LIMITED: 5001,
|
|
62
64
|
UPSTREAM_ERROR: 5101,
|
|
63
65
|
INTERNAL_ERROR: 5201,
|
|
@@ -237,6 +239,8 @@ var STABLE_MESSAGE = {
|
|
|
237
239
|
CHECKOUT_NOT_ALLOWED: "A partial check-out is not allowed in the current state.",
|
|
238
240
|
CHECKOUT_TASK_NOT_FOUND: "Check-out application not found.",
|
|
239
241
|
PAY_PER_CALL_NOT_AVAILABLE: "Pay-per-call billing is not available; use monthly_settlement.",
|
|
242
|
+
HOTEL_NOT_FOUND: "This hotel is no longer available from the supplier.",
|
|
243
|
+
BOOKING_RESTRICTED: "This room has a booking condition that your request doesn't meet. Please check the room's booking rules and adjust your request.",
|
|
240
244
|
NOT_IMPLEMENTED: "This operation is not implemented yet."
|
|
241
245
|
};
|
|
242
246
|
function toErrorEnvelope(error) {
|
|
@@ -1281,6 +1285,12 @@ var hotelCreateOrderSchema = {
|
|
|
1281
1285
|
"contact-email": { type: "string", required: false, description: "Booking contact email" },
|
|
1282
1286
|
"arrive-time": { type: "string", required: false, description: "Expected arrival time", constraints: "HH:mm, hotel local time" },
|
|
1283
1287
|
"special-requests": { type: "string", required: false, description: "Free-text special requests (non-binding)" },
|
|
1288
|
+
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" },
|
|
1289
|
+
"bed-type": {
|
|
1290
|
+
type: "string",
|
|
1291
|
+
required: false,
|
|
1292
|
+
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."
|
|
1293
|
+
},
|
|
1284
1294
|
"payment-token-id": {
|
|
1285
1295
|
type: "string",
|
|
1286
1296
|
required: false,
|
|
@@ -1967,8 +1977,6 @@ var flightCreateOrderSchema = flightSchema(
|
|
|
1967
1977
|
"contact-phone": { type: "string", required: true, description: "Contact phone." },
|
|
1968
1978
|
"contact-email": { type: "string", required: true, description: "Contact email." },
|
|
1969
1979
|
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
1980
|
"idempotency-key": { type: "string", required: true, description: "Forwarded verbatim as the Idempotency-Key header." }
|
|
1973
1981
|
},
|
|
1974
1982
|
{
|
|
@@ -3331,6 +3339,28 @@ function parsePriceItems(raw) {
|
|
|
3331
3339
|
}
|
|
3332
3340
|
return parsed;
|
|
3333
3341
|
}
|
|
3342
|
+
function parseTips(raw) {
|
|
3343
|
+
const INVALID = "--tips must be a JSON array of {title (string, optional), text (string, optional)}.";
|
|
3344
|
+
let parsed;
|
|
3345
|
+
try {
|
|
3346
|
+
parsed = JSON.parse(raw);
|
|
3347
|
+
} catch {
|
|
3348
|
+
throw new CliError("PARAM_INVALID", INVALID);
|
|
3349
|
+
}
|
|
3350
|
+
if (!Array.isArray(parsed)) {
|
|
3351
|
+
throw new CliError("PARAM_INVALID", INVALID);
|
|
3352
|
+
}
|
|
3353
|
+
for (const el of parsed) {
|
|
3354
|
+
if (typeof el !== "object" || el === null || Array.isArray(el)) {
|
|
3355
|
+
throw new CliError("PARAM_INVALID", INVALID);
|
|
3356
|
+
}
|
|
3357
|
+
const item = el;
|
|
3358
|
+
if (item.title !== void 0 && typeof item.title !== "string" || item.text !== void 0 && typeof item.text !== "string") {
|
|
3359
|
+
throw new CliError("PARAM_INVALID", INVALID);
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
return parsed;
|
|
3363
|
+
}
|
|
3334
3364
|
function need7(value, flag) {
|
|
3335
3365
|
if (value === void 0) {
|
|
3336
3366
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
@@ -3381,7 +3411,13 @@ function formatCreateOrder(data) {
|
|
|
3381
3411
|
return out.join("\n");
|
|
3382
3412
|
}
|
|
3383
3413
|
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(
|
|
3414
|
+
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(
|
|
3415
|
+
"--tips <json>",
|
|
3416
|
+
"\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."
|
|
3417
|
+
).option("--hotel-name <name>", "Hotel name (display-only, stored for order summary)").option(
|
|
3418
|
+
"--bed-type <code>",
|
|
3419
|
+
"Product bed-type code from the chosen quote rate's beds[].code (e.g. 'L000000' King / '1000000' Queen); forwarded verbatim to upstream createOrder bedType."
|
|
3420
|
+
).option(
|
|
3385
3421
|
"--payment-token-id <id>",
|
|
3386
3422
|
"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
3423
|
).option(
|
|
@@ -3428,7 +3464,9 @@ function registerHotelCreateOrderCommand(parent, deps) {
|
|
|
3428
3464
|
if (opts.contactEmail !== void 0) body.contact_email = opts.contactEmail;
|
|
3429
3465
|
if (opts.arriveTime !== void 0) body.arrive_time = opts.arriveTime;
|
|
3430
3466
|
if (opts.specialRequests !== void 0) body.special_requests = opts.specialRequests;
|
|
3467
|
+
if (opts.tips !== void 0) body.tips = parseTips(opts.tips);
|
|
3431
3468
|
if (opts.hotelName !== void 0) body.hotel_name = opts.hotelName;
|
|
3469
|
+
if (opts.bedType !== void 0) body.bed_type = opts.bedType;
|
|
3432
3470
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
3433
3471
|
if (!isYes) {
|
|
3434
3472
|
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 +3856,6 @@ function registerHotelGetCommand(parent, deps) {
|
|
|
3818
3856
|
}
|
|
3819
3857
|
|
|
3820
3858
|
// src/hotel-redaug/cancel.ts
|
|
3821
|
-
import { confirm as confirm5 } from "@inquirer/prompts";
|
|
3822
3859
|
function need9(value, flag) {
|
|
3823
3860
|
if (value === void 0) {
|
|
3824
3861
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
@@ -3876,15 +3913,6 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
3876
3913
|
const fcOrderCode = need9(opts.fcOrderCode, "fc-order-code");
|
|
3877
3914
|
const body = { fc_order_code: fcOrderCode };
|
|
3878
3915
|
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
3916
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
3889
3917
|
yes: isYes,
|
|
3890
3918
|
commandPath: "hotel-redaug cancel"
|
|
@@ -3911,7 +3939,7 @@ function registerHotelCancelCommand(parent, deps) {
|
|
|
3911
3939
|
}
|
|
3912
3940
|
|
|
3913
3941
|
// src/hotel-redaug/checkout.ts
|
|
3914
|
-
import { confirm as
|
|
3942
|
+
import { confirm as confirm5 } from "@inquirer/prompts";
|
|
3915
3943
|
function need10(value, flag) {
|
|
3916
3944
|
if (value === void 0) {
|
|
3917
3945
|
throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
|
|
@@ -3997,7 +4025,7 @@ function registerHotelCheckoutCommand(parent, deps) {
|
|
|
3997
4025
|
checkout_rooms: checkoutRooms
|
|
3998
4026
|
};
|
|
3999
4027
|
if (!isYes) {
|
|
4000
|
-
const confirmed = await
|
|
4028
|
+
const confirmed = await confirm5({
|
|
4001
4029
|
message: `Request check-out / out-of-policy cancellation for order ${orderId} (${checkoutRooms.length} room(s))? The property must approve and charges may apply.`,
|
|
4002
4030
|
default: false
|
|
4003
4031
|
});
|
|
@@ -4961,9 +4989,9 @@ function registerVerifyCommand(parent, deps) {
|
|
|
4961
4989
|
}
|
|
4962
4990
|
|
|
4963
4991
|
// src/flight-flink/create-order.ts
|
|
4964
|
-
import { confirm as
|
|
4992
|
+
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
4965
4993
|
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("--
|
|
4994
|
+
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
4995
|
attachSchemaHelp(cmd, flightCreateOrderSchema);
|
|
4968
4996
|
cmd.action(async () => {
|
|
4969
4997
|
const opts = cmd.optsWithGlobals();
|
|
@@ -4985,9 +5013,8 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
4985
5013
|
passengers: jsonArray(need16(opts.passengers, "passengers"), "passengers")
|
|
4986
5014
|
};
|
|
4987
5015
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
4988
|
-
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
4989
5016
|
if (!isYes) {
|
|
4990
|
-
const ok = await
|
|
5017
|
+
const ok = await confirm6({
|
|
4991
5018
|
message: `Create this flight order for ${totalAmount} ${currency}? This locks the fare but does NOT charge yet.`,
|
|
4992
5019
|
default: false
|
|
4993
5020
|
});
|
|
@@ -5026,7 +5053,7 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
5026
5053
|
}
|
|
5027
5054
|
|
|
5028
5055
|
// src/flight-flink/pay-order.ts
|
|
5029
|
-
import { confirm as
|
|
5056
|
+
import { confirm as confirm7 } from "@inquirer/prompts";
|
|
5030
5057
|
function registerPayOrderCommand(parent, deps) {
|
|
5031
5058
|
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
5059
|
attachSchemaHelp(cmd, flightPayOrderSchema);
|
|
@@ -5037,7 +5064,7 @@ function registerPayOrderCommand(parent, deps) {
|
|
|
5037
5064
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5038
5065
|
const orderNo = need16(opts.orderNo, "order-no");
|
|
5039
5066
|
if (!isYes) {
|
|
5040
|
-
const ok = await
|
|
5067
|
+
const ok = await confirm7({
|
|
5041
5068
|
message: `Pay and ticket order ${orderNo}? This settles the order and issues tickets.`,
|
|
5042
5069
|
default: false
|
|
5043
5070
|
});
|
|
@@ -5120,7 +5147,7 @@ function registerGetOrderCommand(parent, deps) {
|
|
|
5120
5147
|
}
|
|
5121
5148
|
|
|
5122
5149
|
// src/flight-flink/cancel-order.ts
|
|
5123
|
-
import { confirm as
|
|
5150
|
+
import { confirm as confirm8 } from "@inquirer/prompts";
|
|
5124
5151
|
function registerCancelOrderCommand(parent, deps) {
|
|
5125
5152
|
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
5153
|
attachSchemaHelp(cmd, flightCancelOrderSchema);
|
|
@@ -5131,7 +5158,7 @@ function registerCancelOrderCommand(parent, deps) {
|
|
|
5131
5158
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5132
5159
|
const orderNo = need16(opts.orderNo, "order-no");
|
|
5133
5160
|
if (!isYes) {
|
|
5134
|
-
const ok = await
|
|
5161
|
+
const ok = await confirm8({
|
|
5135
5162
|
message: `Cancel order ${orderNo}? This requests cancellation and a refund.`,
|
|
5136
5163
|
default: false
|
|
5137
5164
|
});
|
|
@@ -5222,7 +5249,7 @@ function registerChangeSearchCommand(parent, deps) {
|
|
|
5222
5249
|
}
|
|
5223
5250
|
|
|
5224
5251
|
// src/flight-flink/change-apply.ts
|
|
5225
|
-
import { confirm as
|
|
5252
|
+
import { confirm as confirm9 } from "@inquirer/prompts";
|
|
5226
5253
|
function registerChangeApplyCommand(parent, deps) {
|
|
5227
5254
|
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
5255
|
attachSchemaHelp(cmd, flightChangeApplySchema);
|
|
@@ -5242,7 +5269,7 @@ function registerChangeApplyCommand(parent, deps) {
|
|
|
5242
5269
|
contact_email: need16(opts.contactEmail, "contact-email")
|
|
5243
5270
|
};
|
|
5244
5271
|
if (!isYes) {
|
|
5245
|
-
const ok = await
|
|
5272
|
+
const ok = await confirm9({
|
|
5246
5273
|
message: `Submit a change request for order ${body.order_no}?`,
|
|
5247
5274
|
default: false
|
|
5248
5275
|
});
|
|
@@ -5286,7 +5313,7 @@ function registerChangeDetailCommand(parent, deps) {
|
|
|
5286
5313
|
}
|
|
5287
5314
|
|
|
5288
5315
|
// src/flight-flink/change-cancel.ts
|
|
5289
|
-
import { confirm as
|
|
5316
|
+
import { confirm as confirm10 } from "@inquirer/prompts";
|
|
5290
5317
|
function registerChangeCancelCommand(parent, deps) {
|
|
5291
5318
|
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
5319
|
attachSchemaHelp(cmd, flightChangeCancelSchema);
|
|
@@ -5297,7 +5324,7 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5297
5324
|
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5298
5325
|
const changeOrderNo = need16(opts.changeOrderNo, "change-order-no");
|
|
5299
5326
|
if (!isYes) {
|
|
5300
|
-
const ok = await
|
|
5327
|
+
const ok = await confirm10({ message: `Cancel change request ${changeOrderNo}?`, default: false });
|
|
5301
5328
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Change cancellation aborted by user.");
|
|
5302
5329
|
}
|
|
5303
5330
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5318,7 +5345,7 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5318
5345
|
}
|
|
5319
5346
|
|
|
5320
5347
|
// src/flight-flink/refund-apply.ts
|
|
5321
|
-
import { confirm as
|
|
5348
|
+
import { confirm as confirm11 } from "@inquirer/prompts";
|
|
5322
5349
|
function registerRefundApplyCommand(parent, deps) {
|
|
5323
5350
|
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
5351
|
attachSchemaHelp(cmd, flightRefundApplySchema);
|
|
@@ -5339,7 +5366,7 @@ function registerRefundApplyCommand(parent, deps) {
|
|
|
5339
5366
|
};
|
|
5340
5367
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
5341
5368
|
if (!isYes) {
|
|
5342
|
-
const ok = await
|
|
5369
|
+
const ok = await confirm11({
|
|
5343
5370
|
message: `Submit a refund request for order ${body.order_no}?`,
|
|
5344
5371
|
default: false
|
|
5345
5372
|
});
|
|
@@ -5383,7 +5410,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
5383
5410
|
}
|
|
5384
5411
|
|
|
5385
5412
|
// src/flight-flink/refund-confirm.ts
|
|
5386
|
-
import { confirm as
|
|
5413
|
+
import { confirm as confirm12 } from "@inquirer/prompts";
|
|
5387
5414
|
function registerRefundConfirmCommand(parent, deps) {
|
|
5388
5415
|
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
5416
|
attachSchemaHelp(cmd, flightRefundConfirmSchema);
|
|
@@ -5399,7 +5426,7 @@ function registerRefundConfirmCommand(parent, deps) {
|
|
|
5399
5426
|
}
|
|
5400
5427
|
if (!isYes) {
|
|
5401
5428
|
const action = confirmFlag === "1" ? "confirm" : "cancel";
|
|
5402
|
-
const ok = await
|
|
5429
|
+
const ok = await confirm12({ message: `${action} refund ${refundOrderNo}?`, default: false });
|
|
5403
5430
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Refund confirmation aborted by user.");
|
|
5404
5431
|
}
|
|
5405
5432
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|