@agenzo/merchant-cli 0.8.13 → 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/README.md +343 -343
- package/dist/index.js +32 -12
- package/dist/index.js.map +1 -1
- package/package.json +28 -28
package/dist/index.js
CHANGED
|
@@ -2309,12 +2309,13 @@ var flightChangePaySchema = flightSchema(
|
|
|
2309
2309
|
currency: { type: "string", required: false, default: "USD", description: "ISO 4217 currency code." },
|
|
2310
2310
|
"payment-method-id": { type: "string", required: false, description: "Optional bound-card id (EVO path)." },
|
|
2311
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." },
|
|
2312
2313
|
"idempotency-key": { type: "string", required: true, description: "Idempotency-Key header." }
|
|
2313
2314
|
},
|
|
2314
2315
|
{
|
|
2315
2316
|
change_order_no: { type: "string", description: "Change order number." },
|
|
2316
2317
|
status: { type: "string", description: "PROCESSING after payment." },
|
|
2317
|
-
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." }
|
|
2318
2319
|
},
|
|
2319
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." }
|
|
2320
2321
|
);
|
|
@@ -5873,7 +5874,10 @@ function registerChangeCancelCommand(parent, deps) {
|
|
|
5873
5874
|
// src/flight-flink/change-pay.ts
|
|
5874
5875
|
import { confirm as confirm12 } from "@inquirer/prompts";
|
|
5875
5876
|
function registerChangePayCommand(parent, deps) {
|
|
5876
|
-
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");
|
|
5877
5881
|
attachSchemaHelp(cmd, flightChangePaySchema);
|
|
5878
5882
|
cmd.action(async () => {
|
|
5879
5883
|
const opts = cmd.optsWithGlobals();
|
|
@@ -5891,11 +5895,13 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5891
5895
|
};
|
|
5892
5896
|
if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
|
|
5893
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
|
+
}
|
|
5894
5901
|
if (!isYes) {
|
|
5895
|
-
const
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
});
|
|
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 });
|
|
5899
5905
|
if (!ok) throw new CliError("CLIENT_ABORTED", "Change payment aborted by user.");
|
|
5900
5906
|
}
|
|
5901
5907
|
const idempotencyKey = await resolveIdempotencyKey(opts.idempotencyKey, {
|
|
@@ -5911,10 +5917,24 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5911
5917
|
);
|
|
5912
5918
|
spinner?.stop();
|
|
5913
5919
|
if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
|
|
5914
|
-
await render2(
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
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 [
|
|
5918
5938
|
Formatter.keyValue([
|
|
5919
5939
|
["Change order no", String(d.change_order_no ?? "-")],
|
|
5920
5940
|
["Status", String(d.status ?? "-")],
|
|
@@ -5922,8 +5942,8 @@ function registerChangePayCommand(parent, deps) {
|
|
|
5922
5942
|
["Payment status", String(d.payment_status ?? "-")]
|
|
5923
5943
|
]),
|
|
5924
5944
|
Formatter.status("info", "Change fee charged; change ticketing triggered. Poll change-detail until SUCCESS.")
|
|
5925
|
-
].join("\n\n")
|
|
5926
|
-
);
|
|
5945
|
+
].join("\n\n");
|
|
5946
|
+
});
|
|
5927
5947
|
});
|
|
5928
5948
|
}
|
|
5929
5949
|
|