@agenzo/merchant-cli 0.8.1 → 0.8.3
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 +83 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2095,6 +2095,25 @@ var flightChangeCancelSchema = flightSchema(
|
|
|
2095
2095
|
{ status: { type: "int", description: "Terminal 5 (cancelled)." } },
|
|
2096
2096
|
{ command: "agenzo-merchant-cli flight-flink change-cancel --change-order-no C1 --idempotency-key k5", output_summary: "Change request cancelled." }
|
|
2097
2097
|
);
|
|
2098
|
+
var flightChangePaySchema = flightSchema(
|
|
2099
|
+
"change-pay",
|
|
2100
|
+
"Pay a change request fee (charges like a normal order) and trigger change ticketing. flink pay type=1.",
|
|
2101
|
+
{
|
|
2102
|
+
"change-order-no": { type: "string", required: true, description: "Change order number." },
|
|
2103
|
+
"order-no": { type: "string", required: true, description: "Original order reference (ownership check)." },
|
|
2104
|
+
amount: { type: "float", required: true, description: "Change fee total (change-detail price_total, decimal units)." },
|
|
2105
|
+
currency: { type: "string", required: false, default: "USD", description: "ISO 4217 currency code." },
|
|
2106
|
+
"payment-method-id": { type: "string", required: false, description: "Optional bound-card id (EVO path)." },
|
|
2107
|
+
"payment-token-id": { type: "string", required: false, description: "Optional UPI network-token id (unionpay charge path)." },
|
|
2108
|
+
"idempotency-key": { type: "string", required: true, description: "Idempotency-Key header." }
|
|
2109
|
+
},
|
|
2110
|
+
{
|
|
2111
|
+
change_order_no: { type: "string", description: "Change order number." },
|
|
2112
|
+
status: { type: "string", description: "PROCESSING after payment." },
|
|
2113
|
+
payment_status: { type: "string", description: "SETTLED on success." }
|
|
2114
|
+
},
|
|
2115
|
+
{ command: "agenzo-merchant-cli flight-flink change-pay --change-order-no C1 --order-no ffo_... --amount 120 --currency USD --idempotency-key k6", output_summary: "Change fee charged; change ticketing triggered." }
|
|
2116
|
+
);
|
|
2098
2117
|
var flightRefundApplySchema = flightSchema(
|
|
2099
2118
|
"refund-apply",
|
|
2100
2119
|
"Submit a refund request. Returns refund_order_no, status 0 (pending review).",
|
|
@@ -4989,7 +5008,7 @@ function registerVerifyCommand(parent, deps) {
|
|
|
4989
5008
|
// src/flight-flink/create-order.ts
|
|
4990
5009
|
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
4991
5010
|
function registerCreateOrderCommand(parent, deps) {
|
|
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");
|
|
5011
|
+
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("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
4993
5012
|
attachSchemaHelp(cmd, flightCreateOrderSchema);
|
|
4994
5013
|
cmd.action(async () => {
|
|
4995
5014
|
const opts = cmd.optsWithGlobals();
|
|
@@ -5011,6 +5030,7 @@ function registerCreateOrderCommand(parent, deps) {
|
|
|
5011
5030
|
passengers: jsonArray(need16(opts.passengers, "passengers"), "passengers")
|
|
5012
5031
|
};
|
|
5013
5032
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5033
|
+
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
5014
5034
|
if (!isYes) {
|
|
5015
5035
|
const ok = await confirm6({
|
|
5016
5036
|
message: `Create this flight order for ${totalAmount} ${currency}? This locks the fare but does NOT charge yet.`,
|
|
@@ -5342,8 +5362,65 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5342
5362
|
});
|
|
5343
5363
|
}
|
|
5344
5364
|
|
|
5345
|
-
// src/flight-flink/
|
|
5365
|
+
// src/flight-flink/change-pay.ts
|
|
5346
5366
|
import { confirm as confirm11 } from "@inquirer/prompts";
|
|
5367
|
+
function registerChangePayCommand(parent, deps) {
|
|
5368
|
+
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");
|
|
5369
|
+
attachSchemaHelp(cmd, flightChangePaySchema);
|
|
5370
|
+
cmd.action(async () => {
|
|
5371
|
+
const opts = cmd.optsWithGlobals();
|
|
5372
|
+
const format = resolveFormat(opts.format);
|
|
5373
|
+
const isYes = Boolean(opts.yes);
|
|
5374
|
+
const apiKey = await resolveApiKey(opts.apiKey);
|
|
5375
|
+
const changeOrderNo = need16(opts.changeOrderNo, "change-order-no");
|
|
5376
|
+
const orderNo = need16(opts.orderNo, "order-no");
|
|
5377
|
+
const amount = num8(opts.amount, "amount");
|
|
5378
|
+
const currency = need16(opts.currency, "currency");
|
|
5379
|
+
const body = {
|
|
5380
|
+
order_no: orderNo,
|
|
5381
|
+
amount,
|
|
5382
|
+
currency
|
|
5383
|
+
};
|
|
5384
|
+
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5385
|
+
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
5386
|
+
if (!isYes) {
|
|
5387
|
+
const ok = await confirm11({
|
|
5388
|
+
message: `Pay change fee ${amount} ${currency} for change order ${changeOrderNo}? This charges the customer and triggers change ticketing.`,
|
|
5389
|
+
default: false
|
|
5390
|
+
});
|
|
5391
|
+
if (!ok) throw new CliError("CLIENT_ABORTED", "Change payment aborted by user.");
|
|
5392
|
+
}
|
|
5393
|
+
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
5394
|
+
yes: isYes,
|
|
5395
|
+
commandPath: "flight-flink change-pay"
|
|
5396
|
+
});
|
|
5397
|
+
const spinner = format === "json" ? null : createSpinner("Paying change request...");
|
|
5398
|
+
const result = await deps.apiClient.post(
|
|
5399
|
+
`/flight/change/${encodeURIComponent(changeOrderNo)}/pay`,
|
|
5400
|
+
{ type: "api-key", key: apiKey },
|
|
5401
|
+
body,
|
|
5402
|
+
{ "Idempotency-Key": idempotencyKey }
|
|
5403
|
+
);
|
|
5404
|
+
spinner?.stop();
|
|
5405
|
+
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
5406
|
+
await render2(
|
|
5407
|
+
result.data,
|
|
5408
|
+
opts.format,
|
|
5409
|
+
(d) => [
|
|
5410
|
+
Formatter.keyValue([
|
|
5411
|
+
["Change order no", String(d.change_order_no ?? "-")],
|
|
5412
|
+
["Status", String(d.status ?? "-")],
|
|
5413
|
+
["Amount", `${d.amount ?? "-"} ${d.currency ?? ""}`.trim()],
|
|
5414
|
+
["Payment status", String(d.payment_status ?? "-")]
|
|
5415
|
+
]),
|
|
5416
|
+
Formatter.status("info", "Change fee charged; change ticketing triggered. Poll change-detail until SUCCESS.")
|
|
5417
|
+
].join("\n\n")
|
|
5418
|
+
);
|
|
5419
|
+
});
|
|
5420
|
+
}
|
|
5421
|
+
|
|
5422
|
+
// src/flight-flink/refund-apply.ts
|
|
5423
|
+
import { confirm as confirm12 } from "@inquirer/prompts";
|
|
5347
5424
|
function registerRefundApplyCommand(parent, deps) {
|
|
5348
5425
|
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");
|
|
5349
5426
|
attachSchemaHelp(cmd, flightRefundApplySchema);
|
|
@@ -5364,7 +5441,7 @@ function registerRefundApplyCommand(parent, deps) {
|
|
|
5364
5441
|
};
|
|
5365
5442
|
if (opts.reason !== void 0) body.reason = opts.reason;
|
|
5366
5443
|
if (!isYes) {
|
|
5367
|
-
const ok = await
|
|
5444
|
+
const ok = await confirm12({
|
|
5368
5445
|
message: `Submit a refund request for order ${body.order_no}?`,
|
|
5369
5446
|
default: false
|
|
5370
5447
|
});
|
|
@@ -5408,7 +5485,7 @@ function registerRefundDetailCommand(parent, deps) {
|
|
|
5408
5485
|
}
|
|
5409
5486
|
|
|
5410
5487
|
// src/flight-flink/refund-confirm.ts
|
|
5411
|
-
import { confirm as
|
|
5488
|
+
import { confirm as confirm13 } from "@inquirer/prompts";
|
|
5412
5489
|
function registerRefundConfirmCommand(parent, deps) {
|
|
5413
5490
|
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");
|
|
5414
5491
|
attachSchemaHelp(cmd, flightRefundConfirmSchema);
|
|
@@ -5424,7 +5501,7 @@ function registerRefundConfirmCommand(parent, deps) {
|
|
|
5424
5501
|
}
|
|
5425
5502
|
if (!isYes) {
|
|
5426
5503
|
const action = confirmFlag === "1" ? "confirm" : "cancel";
|
|
5427
|
-
const ok = await
|
|
5504
|
+
const ok = await confirm13({ message: `${action} refund ${refundOrderNo}?`, default: false });
|
|
5428
5505
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Refund confirmation aborted by user.");
|
|
5429
5506
|
}
|
|
5430
5507
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5677,6 +5754,7 @@ Key notes:
|
|
|
5677
5754
|
registerChangeApplyCommand(flightCmd, deps);
|
|
5678
5755
|
registerChangeDetailCommand(flightCmd, deps);
|
|
5679
5756
|
registerChangeCancelCommand(flightCmd, deps);
|
|
5757
|
+
registerChangePayCommand(flightCmd, deps);
|
|
5680
5758
|
registerRefundApplyCommand(flightCmd, deps);
|
|
5681
5759
|
registerRefundDetailCommand(flightCmd, deps);
|
|
5682
5760
|
registerRefundConfirmCommand(flightCmd, deps);
|