@agenzo/merchant-cli 0.8.12 → 0.8.14
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 +41 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1047,6 +1047,11 @@ var bookSchema = {
|
|
|
1047
1047
|
required: false,
|
|
1048
1048
|
description: "Bound payment method id to charge (pay_per_call only). Opaque id from `token payment-methods list`; ignored for monthly_settlement"
|
|
1049
1049
|
},
|
|
1050
|
+
"payment-token-id": {
|
|
1051
|
+
type: "string",
|
|
1052
|
+
required: false,
|
|
1053
|
+
description: "UPI Agent Pay: network-token id from an already-completed UnionPay/Visa capture. When set, the platform skips EVO preauth/capture and only books the ride + records this credential (funds already charged)"
|
|
1054
|
+
},
|
|
1050
1055
|
member: MEMBER_FLAG_SCHEMA,
|
|
1051
1056
|
"passenger-name": { type: "string", required: true, description: "Passenger full name" },
|
|
1052
1057
|
"passenger-phone": { type: "string", required: true, description: "Passenger phone in E.164 format (e.g. +14155551234)" },
|
|
@@ -2304,12 +2309,13 @@ var flightChangePaySchema = flightSchema(
|
|
|
2304
2309
|
currency: { type: "string", required: false, default: "USD", description: "ISO 4217 currency code." },
|
|
2305
2310
|
"payment-method-id": { type: "string", required: false, description: "Optional bound-card id (EVO path)." },
|
|
2306
2311
|
"payment-token-id": { type: "string", required: false, description: "Optional UPI network-token id (unionpay charge path)." },
|
|
2312
|
+
"authorized-merchant-trans-id": { type: "string", required: false, description: "Resume a 3DS challenge with the merchant trans id of the already-authorised preauth; the platform reuses and captures it instead of authorizing again." },
|
|
2307
2313
|
"idempotency-key": { type: "string", required: true, description: "Idempotency-Key header." }
|
|
2308
2314
|
},
|
|
2309
2315
|
{
|
|
2310
2316
|
change_order_no: { type: "string", description: "Change order number." },
|
|
2311
2317
|
status: { type: "string", description: "PROCESSING after payment." },
|
|
2312
|
-
payment_status: { type: "string", description: "SETTLED on success." }
|
|
2318
|
+
payment_status: { type: "string", description: "SETTLED on success. Absent when the card needs 3DS \u2014 the response then carries a challenge object instead (status AUTHENTICATION_REQUIRED, three_ds_url, merchant_trans_id) and nothing has been charged yet." }
|
|
2313
2319
|
},
|
|
2314
2320
|
{ 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." }
|
|
2315
2321
|
);
|
|
@@ -2538,6 +2544,9 @@ function registerBookCommand(parent, deps) {
|
|
|
2538
2544
|
const cmd = parent.command("book").description("Book a ride using a quote_id returned by quote").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--quote-id <id>", "Quote id from `ride-elife quote`").option("--vehicle-class <class>", "Chosen vehicle class").option("--price-amount <amount>", "Fare in decimal currency units (not cents)").option("--price-currency <currency>", "Currency code (default USD)").option("--payment-order-id <id>", "Paid payment order id (pay_per_call mode only)").option(
|
|
2539
2545
|
"--payment-method-id <id>",
|
|
2540
2546
|
"Bound payment method id to charge (pay_per_call mode only)"
|
|
2547
|
+
).option(
|
|
2548
|
+
"--payment-token-id <id>",
|
|
2549
|
+
"UPI Agent Pay: payment token id from an already-completed UnionPay/Visa network-token capture. When set, the platform skips EVO preauth/capture and only books the ride + records this credential (funds already charged)."
|
|
2541
2550
|
).option(
|
|
2542
2551
|
"--authorized-merchant-trans-id <id>",
|
|
2543
2552
|
"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)."
|
|
@@ -2565,6 +2574,7 @@ function registerBookCommand(parent, deps) {
|
|
|
2565
2574
|
};
|
|
2566
2575
|
if (opts.paymentOrderId) body.payment_order_id = opts.paymentOrderId;
|
|
2567
2576
|
if (opts.paymentMethodId) body.payment_method_id = opts.paymentMethodId;
|
|
2577
|
+
if (opts.paymentTokenId) body.payment_token_id = opts.paymentTokenId;
|
|
2568
2578
|
if (opts.authorizedMerchantTransId) {
|
|
2569
2579
|
body.authorized_merchant_trans_id = opts.authorizedMerchantTransId;
|
|
2570
2580
|
}
|
|
@@ -5864,7 +5874,10 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5864
5874
|
// src/flight-flink/change-pay.ts
|
|
5865
5875
|
import { confirm as confirm12 } from "@inquirer/prompts";
|
|
5866
5876
|
function registerChangePayCommand(parent, deps) {
|
|
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(
|
|
5877
|
+
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(
|
|
5878
|
+
"--authorized-merchant-trans-id <id>",
|
|
5879
|
+
"Resume a 3DS challenge: merchant trans id of the already-authorised preauth"
|
|
5880
|
+
).option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
|
|
5868
5881
|
attachSchemaHelp(cmd, flightChangePaySchema);
|
|
5869
5882
|
cmd.action(async () => {
|
|
5870
5883
|
const opts = cmd.optsWithGlobals();
|
|
@@ -5882,11 +5895,13 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5882
5895
|
};
|
|
5883
5896
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5884
5897
|
if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
|
|
5898
|
+
if (opts.authorizedMerchantTransId !== void 0) {
|
|
5899
|
+
body.authorized_merchant_trans_id = opts.authorizedMerchantTransId;
|
|
5900
|
+
}
|
|
5885
5901
|
if (!isYes) {
|
|
5886
|
-
const
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
});
|
|
5902
|
+
const isResume = opts.authorizedMerchantTransId !== void 0;
|
|
5903
|
+
const message = isResume ? `Resume change fee ${amount} ${currency} for change order ${changeOrderNo}? The card is already authorised; this captures it and triggers change ticketing.` : `Pay change fee ${amount} ${currency} for change order ${changeOrderNo}? This charges the customer and triggers change ticketing.`;
|
|
5904
|
+
const ok = await confirm12({ message, default: false });
|
|
5890
5905
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Change payment aborted by user.");
|
|
5891
5906
|
}
|
|
5892
5907
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5902,10 +5917,24 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5902
5917
|
);
|
|
5903
5918
|
spinner?.stop();
|
|
5904
5919
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
5905
|
-
await render2(
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5920
|
+
await render2(result.data, opts.format, (d) => {
|
|
5921
|
+
const challenge = d.challenge ?? null;
|
|
5922
|
+
if (challenge) {
|
|
5923
|
+
return [
|
|
5924
|
+
Formatter.keyValue([
|
|
5925
|
+
["Change order no", String(challenge.change_order_no ?? "-")],
|
|
5926
|
+
["Status", String(challenge.status ?? "-")],
|
|
5927
|
+
["Amount", `${challenge.amount ?? "-"} ${challenge.currency ?? ""}`.trim()],
|
|
5928
|
+
["Authentication URL", String(challenge.three_ds_url ?? "-")],
|
|
5929
|
+
["Merchant trans id", String(challenge.merchant_trans_id ?? "-")]
|
|
5930
|
+
]),
|
|
5931
|
+
Formatter.status(
|
|
5932
|
+
"warning",
|
|
5933
|
+
"Not charged yet \u2014 the card requires 3-D Secure and the funds are not held. Open the authentication URL, then re-run change-pay with --authorized-merchant-trans-id <merchant trans id>."
|
|
5934
|
+
)
|
|
5935
|
+
].join("\n\n");
|
|
5936
|
+
}
|
|
5937
|
+
return [
|
|
5909
5938
|
Formatter.keyValue([
|
|
5910
5939
|
["Change order no", String(d.change_order_no ?? "-")],
|
|
5911
5940
|
["Status", String(d.status ?? "-")],
|
|
@@ -5913,8 +5942,8 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5913
5942
|
["Payment status", String(d.payment_status ?? "-")]
|
|
5914
5943
|
]),
|
|
5915
5944
|
Formatter.status("info", "Change fee charged; change ticketing triggered. Poll change-detail until SUCCESS.")
|
|
5916
|
-
].join("\n\n")
|
|
5917
|
-
);
|
|
5945
|
+
].join("\n\n");
|
|
5946
|
+
});
|
|
5918
5947
|
});
|
|
5919
5948
|
}
|
|
5920
5949
|
|