@curless/hotel-storefront 0.49.1 → 0.50.0

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.
Files changed (68) hide show
  1. package/dist/backend.d.ts +1 -1
  2. package/dist/card.generated.d.ts +1 -1
  3. package/dist/card.generated.js +2 -2
  4. package/dist/card.generated.js.map +1 -1
  5. package/dist/config.d.ts +16 -18
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js.map +1 -1
  8. package/dist/demo-hotels.d.ts.map +1 -1
  9. package/dist/demo-hotels.js +3 -1
  10. package/dist/demo-hotels.js.map +1 -1
  11. package/dist/huazhu/backend.d.ts +2 -2
  12. package/dist/huazhu/backend.d.ts.map +1 -1
  13. package/dist/huazhu/backend.js +14 -12
  14. package/dist/huazhu/backend.js.map +1 -1
  15. package/dist/huazhu/bookings.d.ts +8 -5
  16. package/dist/huazhu/bookings.d.ts.map +1 -1
  17. package/dist/huazhu/bookings.js.map +1 -1
  18. package/dist/huazhu/check.d.ts +1 -1
  19. package/dist/huazhu/make.d.ts.map +1 -1
  20. package/dist/huazhu/make.js +6 -32
  21. package/dist/huazhu/make.js.map +1 -1
  22. package/dist/huazhu/sellable.d.ts.map +1 -1
  23. package/dist/huazhu/sellable.js +4 -3
  24. package/dist/huazhu/sellable.js.map +1 -1
  25. package/dist/index.js +0 -0
  26. package/dist/legal.d.ts.map +1 -1
  27. package/dist/legal.js +9 -15
  28. package/dist/legal.js.map +1 -1
  29. package/dist/payments/checkout.d.ts +10 -70
  30. package/dist/payments/checkout.d.ts.map +1 -1
  31. package/dist/payments/checkout.js +14 -131
  32. package/dist/payments/checkout.js.map +1 -1
  33. package/dist/payments/stripe-checkout.js +4 -4
  34. package/dist/payments/stripe-checkout.js.map +1 -1
  35. package/dist/present.d.ts +15 -7
  36. package/dist/present.d.ts.map +1 -1
  37. package/dist/present.js +26 -8
  38. package/dist/present.js.map +1 -1
  39. package/dist/same-booking.d.ts +9 -0
  40. package/dist/same-booking.d.ts.map +1 -1
  41. package/dist/same-booking.js +13 -1
  42. package/dist/same-booking.js.map +1 -1
  43. package/dist/server.d.ts +3 -3
  44. package/dist/server.d.ts.map +1 -1
  45. package/dist/server.js +6 -3
  46. package/dist/server.js.map +1 -1
  47. package/dist/supplier.d.ts +4 -1
  48. package/dist/supplier.d.ts.map +1 -1
  49. package/dist/supplier.js.map +1 -1
  50. package/dist/surface.d.ts +8 -0
  51. package/dist/surface.d.ts.map +1 -1
  52. package/dist/surface.js +23 -7
  53. package/dist/surface.js.map +1 -1
  54. package/dist/tools.d.ts +8 -0
  55. package/dist/tools.d.ts.map +1 -1
  56. package/dist/tools.js +148 -9
  57. package/dist/tools.js.map +1 -1
  58. package/dist/trip.d.ts +18 -2
  59. package/dist/trip.d.ts.map +1 -1
  60. package/dist/trip.js +27 -1
  61. package/dist/trip.js.map +1 -1
  62. package/dist/types.d.ts +11 -4
  63. package/dist/types.d.ts.map +1 -1
  64. package/package.json +13 -14
  65. package/dist/payments/fake-gateway.d.ts +0 -43
  66. package/dist/payments/fake-gateway.d.ts.map +0 -1
  67. package/dist/payments/fake-gateway.js +0 -135
  68. package/dist/payments/fake-gateway.js.map +0 -1
@@ -1779,10 +1779,12 @@ export const createHuazhuHotels = (opts) => {
1779
1779
  const liveForEmail = store.all().filter((b) => b.guest.email.trim().toLowerCase() === email && isLive(b)).length +
1780
1780
  slotsWhere((x) => x.email === email);
1781
1781
  if (liveForEmail + lines.length > limits.perEmailLive) {
1782
- throw new Error(`Nothing was booked. ${guest.email.trim()} already has ${plural(liveForEmail, 'booking')} still to come through this connector, and ${limits.perEmailLive} at once is the most - cancel one that is not needed, then ask again.`);
1782
+ // ⚠️ "THIS EMAIL", NEVER THE ADDRESS (2026-10-29 audit, H5): these words
1783
+ // go back to the model, and what the guest typed on the card does not.
1784
+ throw new Error(`Nothing was booked. This email already has ${plural(liveForEmail, 'booking')} still to come through this connector, and ${limits.perEmailLive} at once is the most - cancel one that is not needed, then ask again.`);
1783
1785
  }
1784
1786
  if (requestsByEmail.count(email) >= limits.perEmailPerDay) {
1785
- throw new Error(`Nothing was booked. ${guest.email.trim()} has asked for ${plural(limits.perEmailPerDay, 'booking')} in the last 24 hours, which is the most here - try again later.`);
1787
+ throw new Error(`Nothing was booked. This email has asked for ${plural(limits.perEmailPerDay, 'booking')} in the last 24 hours, which is the most here - try again later.`);
1786
1788
  }
1787
1789
  if (requestsByConversation.count(conversationOf(who)) >= limits.perConversationPerHour) {
1788
1790
  throw new Error(`Nothing was booked. This conversation has asked for ${plural(limits.perConversationPerHour, 'booking')} in the last hour, which is the most here - try again later.`);
@@ -2039,9 +2041,9 @@ export const createHuazhuHotels = (opts) => {
2039
2041
  await refundOf(id, said);
2040
2042
  };
2041
2043
  /**
2042
- * Gives a guest's money back, in full - the only refund the gateway makes.
2043
- * Written down with the gateway's checkout session (its payment intent)
2044
- * and, once open, its refund request: the two ids the money is found by.
2044
+ * Gives a guest's money back, in full. Written down with the checkout
2045
+ * session (Stripe's, whose payment intent a refund names) and, once open,
2046
+ * its refund: the two ids the money is found by.
2045
2047
  */
2046
2048
  const refundOf = async (id, reason) => {
2047
2049
  const row = store.get(id);
@@ -2081,7 +2083,7 @@ export const createHuazhuHotels = (opts) => {
2081
2083
  },
2082
2084
  });
2083
2085
  if (tries >= 8)
2084
- raise(id, `the guest paid (gateway session ${p.sessionId}) and the refund could not be opened`);
2086
+ raise(id, `the guest paid (payment session ${p.sessionId}) and the refund could not be opened`);
2085
2087
  }
2086
2088
  };
2087
2089
  /**
@@ -2131,8 +2133,8 @@ export const createHuazhuHotels = (opts) => {
2131
2133
  };
2132
2134
  const fee = formatMoney(money(feeMinor, b.quote.total.currency));
2133
2135
  const why = byGuest
2134
- ? `cancelled with a fee of ${fee} of the ${formatMoney(b.quote.total)} paid (gateway session ${p.sessionId}): the difference is owed back, and a part refund is not made here`
2135
- : `Huazhu shows ${b.distributorResId} cancelled - not by the guest here - after its free period (a fee of ${fee} by its terms) with ${formatMoney(b.quote.total)} paid (gateway session ${p.sessionId}): whether the guest is owed it back is to be judged with Huazhu`;
2136
+ ? `cancelled with a fee of ${fee} of the ${formatMoney(b.quote.total)} paid (payment session ${p.sessionId}): the difference is owed back, and a part refund is not made here`
2137
+ : `Huazhu shows ${b.distributorResId} cancelled - not by the guest here - after its free period (a fee of ${fee} by its terms) with ${formatMoney(b.quote.total)} paid (payment session ${p.sessionId}): whether the guest is owed it back is to be judged with Huazhu`;
2136
2138
  console.error(`[huazhu prepaid ${b.id}] ⚠️ NEEDS A PERSON: ${why}`);
2137
2139
  return {
2138
2140
  row: {
@@ -2548,7 +2550,7 @@ export const createHuazhuHotels = (opts) => {
2548
2550
  if (latest && status !== latest.status)
2549
2551
  patch(row.id, {}, { refund: { ...latest, status } });
2550
2552
  if (status === 'failed' || status === 'rejected')
2551
- raise(row.id, `refund ${refund.requestId} of gateway session ${p.sessionId} came back ${status}: the guest's money is not back`);
2553
+ raise(row.id, `refund ${refund.requestId} of payment session ${p.sessionId} came back ${status}: the guest's money is not back`);
2552
2554
  }
2553
2555
  catch {
2554
2556
  // asked again on the next pass
@@ -2783,7 +2785,7 @@ export const createHuazhuHotels = (opts) => {
2783
2785
  requestsByConversation.add(conversationOf(who));
2784
2786
  const tripRef = randomUUID();
2785
2787
  // ⚠️ PAID FIRST, BOOKED AFTER. A stay paid in advance is not asked of
2786
- // Huazhu until the guest has paid on the gateway's card page - then
2788
+ // Huazhu until the guest has paid on Stripe's checkout page - then
2787
2789
  // `settlePrepaid` books it, and gives the money back whole if it cannot.
2788
2790
  const prepaidPlan = plans.find((p) => p.sold.res.prepaid);
2789
2791
  if (prepaidPlan) {
@@ -4179,7 +4181,7 @@ export const createHuazhuHotels = (opts) => {
4179
4181
  : '';
4180
4182
  // A booking paid here in advance, in either: the money is a test too.
4181
4183
  const paidTestNote = opts.sandbox
4182
- ? ' This is a test booking in the simulated Huazhu, paid in the gateway’s test mode: no real money moves.'
4184
+ ? ' This is a test booking in the simulated Huazhu, paid in Stripe’s test mode: no real money moves.'
4183
4185
  : opts.testEnvironment
4184
4186
  ? ' This is a test booking in Huazhu’s test system, paid in test mode: no real money moves.'
4185
4187
  : '';
@@ -4359,7 +4361,7 @@ export const createHuazhuHotels = (opts) => {
4359
4361
  cancelledAt: when,
4360
4362
  });
4361
4363
  const paid = formatMoney(b.quote.total);
4362
- raise(b.id, `Huazhu answered 5402 (already cancelled) to the cancellation of ${b.distributorResId}, and does not say when it was cancelled, and what cancelling cost was not the same at every moment since the booking was made (the free period ended before this was found, or the terms cannot be read), so what of the ${paid} paid (gateway session ${p?.sessionId}) comes back - whole if it was cancelled inside the free period, less the fee if after - is to be judged with Huazhu; nothing was refunded or kept`);
4364
+ raise(b.id, `Huazhu answered 5402 (already cancelled) to the cancellation of ${b.distributorResId}, and does not say when it was cancelled, and what cancelling cost was not the same at every moment since the booking was made (the free period ended before this was found, or the terms cannot be read), so what of the ${paid} paid (payment session ${p?.sessionId}) comes back - whole if it was cancelled inside the free period, less the fee if after - is to be judged with Huazhu; nothing was refunded or kept`);
4363
4365
  throw new Error(`Huazhu says ${b.confirmationCode} is already cancelled, but not when - and what cancelling costs depends on when - so what comes back of the ${paid} paid cannot be worked out here. The booking is shown as cancelled; nothing has been refunded or kept yet, and a person here is settling it with Huazhu.`);
4364
4366
  }
4365
4367
  }