@agenzo/merchant-cli 0.8.3 → 0.8.4

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
@@ -59,6 +59,7 @@ var CODE_NUM = {
59
59
  CHECKOUT_TASK_NOT_FOUND: 4307,
60
60
  PAY_PER_CALL_NOT_AVAILABLE: 4308,
61
61
  HOTEL_NOT_FOUND: 4309,
62
+ BOOKING_RESTRICTED: 4310,
62
63
  RATE_LIMITED: 5001,
63
64
  UPSTREAM_ERROR: 5101,
64
65
  INTERNAL_ERROR: 5201,
@@ -239,6 +240,7 @@ var STABLE_MESSAGE = {
239
240
  CHECKOUT_TASK_NOT_FOUND: "Check-out application not found.",
240
241
  PAY_PER_CALL_NOT_AVAILABLE: "Pay-per-call billing is not available; use monthly_settlement.",
241
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.",
242
244
  NOT_IMPLEMENTED: "This operation is not implemented yet."
243
245
  };
244
246
  function toErrorEnvelope(error) {
@@ -3378,6 +3380,19 @@ function parseTips(raw) {
3378
3380
  }
3379
3381
  return parsed;
3380
3382
  }
3383
+ function parseCancellation(raw) {
3384
+ const INVALID = "--cancellation must be a JSON object.";
3385
+ let parsed;
3386
+ try {
3387
+ parsed = JSON.parse(raw);
3388
+ } catch {
3389
+ throw new CliError("PARAM_INVALID", INVALID);
3390
+ }
3391
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
3392
+ throw new CliError("PARAM_INVALID", INVALID);
3393
+ }
3394
+ return parsed;
3395
+ }
3381
3396
  function need7(value, flag) {
3382
3397
  if (value === void 0) {
3383
3398
  throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
@@ -3432,6 +3447,12 @@ function registerHotelCreateOrderCommand(parent, deps) {
3432
3447
  "--tips <json>",
3433
3448
  "\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."
3434
3449
  ).option("--hotel-name <name>", "Hotel name (display-only, stored for order summary)").option(
3450
+ "--cancellation <json>",
3451
+ "Cancellation policy JSON from the chosen rate ({restriction_type,restriction_day,restriction_time,penalties[]}); stored on the order for cancellation gating and free-cancel deadline display. Not sent upstream."
3452
+ ).option(
3453
+ "--hotel-timezone <tz>",
3454
+ "Hotel timezone from quote (e.g. 'UTC-5'); stored to compute the free-cancellation deadline in hotel-local time."
3455
+ ).option(
3435
3456
  "--bed-type <code>",
3436
3457
  "Product bed-type code from the chosen quote rate's beds[].code (e.g. 'L000000' King / '1000000' Queen); forwarded verbatim to upstream createOrder bedType."
3437
3458
  ).option(
@@ -3482,6 +3503,8 @@ function registerHotelCreateOrderCommand(parent, deps) {
3482
3503
  if (opts.arriveTime !== void 0) body.arrive_time = opts.arriveTime;
3483
3504
  if (opts.specialRequests !== void 0) body.special_requests = opts.specialRequests;
3484
3505
  if (opts.tips !== void 0) body.tips = parseTips(opts.tips);
3506
+ if (opts.cancellation !== void 0) body.cancellation = parseCancellation(opts.cancellation);
3507
+ if (opts.hotelTimezone !== void 0) body.hotel_timezone = opts.hotelTimezone;
3485
3508
  if (opts.hotelName !== void 0) body.hotel_name = opts.hotelName;
3486
3509
  if (opts.bedType !== void 0) body.bed_type = opts.bedType;
3487
3510
  if (opts.paymentTokenId !== void 0) body.payment_token_id = opts.paymentTokenId;