@agenzo/merchant-cli 0.8.14 → 0.8.15

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 CHANGED
@@ -1519,9 +1519,24 @@ var hotelPayOrderSchema = {
1519
1519
  cli: CLI_NAME,
1520
1520
  noun: HOTEL_NOUN,
1521
1521
  verb: "pay-order",
1522
- description: 'Settle an existing AWAITING_PAYMENT order created by create-order. Takes only --order-id; the billing path is decided server-side by the order billing_mode. monthly_settlement deducts from the developer credit account then confirms with the supplier; pay_per_call verifies the user EVO payment \u2014 the EVO merchantTransID IS the order_id (the user pays via EVO under the order_id), so the platform queries EVO for that order_id and requires an exact amount/currency match before confirming (the response settlement_path is then "pay_per_call"). On success the order becomes PAID. Supports --watch to poll on PAYMENT_NOT_COMPLETED until PAID',
1522
+ description: "Settle an existing AWAITING_PAYMENT order created by create-order. Charging happens in this step \u2014 platform create-order only locks inventory/price and moves no money (lock-then-pay). Optional payment credentials (--payment-method-id / --payment-token-id / --authorized-merchant-trans-id) are forwarded to the pay body; omit them to let the platform settle by billing_mode (monthly_settlement deducts credit; pay_per_call selects the developer default card / EVO preauth). Token wins over method id server-side. On EVO cardholder authentication the response is AUTHENTICATION_REQUIRED with a three_ds_url + merchant_trans_id; resume by re-calling pay-order with --authorized-merchant-trans-id. On success the order becomes PAID. Supports --watch to poll on PAYMENT_NOT_COMPLETED until PAID",
1523
1523
  flags: {
1524
- "order-id": { type: "string", required: true, description: "Order to settle (create-order.response.order_id). For pay_per_call this is also the EVO merchantTransID the user paid under." },
1524
+ "order-id": { type: "string", required: true, description: "Order to settle (create-order.response.order_id)." },
1525
+ "payment-method-id": {
1526
+ type: "string",
1527
+ required: false,
1528
+ description: "Optional bound-card id to charge (pay_per_call / EVO preauth). Ignored for monthly_settlement and when payment-token-id is set."
1529
+ },
1530
+ "payment-token-id": {
1531
+ type: "string",
1532
+ required: false,
1533
+ description: "Optional network-token id (UnionPay/Visa). When set the platform settles via network-token direct charge instead of EVO preauth+capture. Wins over payment-method-id."
1534
+ },
1535
+ "authorized-merchant-trans-id": {
1536
+ type: "string",
1537
+ required: false,
1538
+ description: "Resume a 3DS challenge: merchant trans id of an already-authorised preauth returned by a prior AUTHENTICATION_REQUIRED response. Reuses that authorization instead of creating a new one (pay_per_call only)."
1539
+ },
1525
1540
  "idempotency-key": {
1526
1541
  type: "string",
1527
1542
  required: true,
@@ -4151,7 +4166,10 @@ function isPaymentTerminal(record) {
4151
4166
  return status === "PAID";
4152
4167
  }
4153
4168
  function registerHotelPayOrderCommand(parent, deps) {
4154
- const cmd = parent.command("pay-order").description("Settle an existing hotel order (path decided by billing_mode: monthly_settlement or pay_per_call)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-id <id>", "Order ID to pay (from create-order response)").option(
4169
+ const cmd = parent.command("pay-order").description("Settle an existing hotel order (path decided by billing_mode: monthly_settlement or pay_per_call)").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--order-id <id>", "Order ID to pay (from create-order response)").option("--payment-method-id <id>", "Optional bound-card id to charge (pay_per_call / EVO preauth)").option("--payment-token-id <id>", "Optional network-token id (unionpay/visa charge path)").option(
4170
+ "--authorized-merchant-trans-id <id>",
4171
+ "Resume a 3DS challenge: merchant trans id of an already-authorised preauth"
4172
+ ).option(
4155
4173
  "--idempotency-key <key>",
4156
4174
  "Idempotency key forwarded verbatim as the Idempotency-Key header"
4157
4175
  ).option("--watch", "Poll until PAID or timeout (NDJSON output)", false).option(
@@ -4184,6 +4202,11 @@ function registerHotelPayOrderCommand(parent, deps) {
4184
4202
  const watchInterval = resolveSeconds(opts.watchInterval, DEFAULT_PAY_WATCH_INTERVAL_SECONDS);
4185
4203
  const watchTimeout = resolveSeconds(opts.watchTimeout, DEFAULT_PAY_WATCH_TIMEOUT_SECONDS);
4186
4204
  const body = {};
4205
+ if (opts.paymentMethodId !== void 0) body.payment_method_id = opts.paymentMethodId;
4206
+ if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;
4207
+ if (opts.authorizedMerchantTransId !== void 0) {
4208
+ body.authorized_merchant_trans_id = opts.authorizedMerchantTransId;
4209
+ }
4187
4210
  if (!isYes) {
4188
4211
  const confirmed = await confirm5({
4189
4212
  message: `Settle hotel order ${orderId}? This moves money via the order's configured billing mode (monthly_settlement or pay_per_call).`,