@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.
- package/dist/backend.d.ts +1 -1
- package/dist/card.generated.d.ts +1 -1
- package/dist/card.generated.js +2 -2
- package/dist/card.generated.js.map +1 -1
- package/dist/config.d.ts +16 -18
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/demo-hotels.d.ts.map +1 -1
- package/dist/demo-hotels.js +3 -1
- package/dist/demo-hotels.js.map +1 -1
- package/dist/huazhu/backend.d.ts +2 -2
- package/dist/huazhu/backend.d.ts.map +1 -1
- package/dist/huazhu/backend.js +14 -12
- package/dist/huazhu/backend.js.map +1 -1
- package/dist/huazhu/bookings.d.ts +8 -5
- package/dist/huazhu/bookings.d.ts.map +1 -1
- package/dist/huazhu/bookings.js.map +1 -1
- package/dist/huazhu/check.d.ts +1 -1
- package/dist/huazhu/make.d.ts.map +1 -1
- package/dist/huazhu/make.js +6 -32
- package/dist/huazhu/make.js.map +1 -1
- package/dist/huazhu/sellable.d.ts.map +1 -1
- package/dist/huazhu/sellable.js +4 -3
- package/dist/huazhu/sellable.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/legal.d.ts.map +1 -1
- package/dist/legal.js +9 -15
- package/dist/legal.js.map +1 -1
- package/dist/payments/checkout.d.ts +10 -70
- package/dist/payments/checkout.d.ts.map +1 -1
- package/dist/payments/checkout.js +14 -131
- package/dist/payments/checkout.js.map +1 -1
- package/dist/payments/stripe-checkout.js +4 -4
- package/dist/payments/stripe-checkout.js.map +1 -1
- package/dist/present.d.ts +15 -7
- package/dist/present.d.ts.map +1 -1
- package/dist/present.js +26 -8
- package/dist/present.js.map +1 -1
- package/dist/same-booking.d.ts +9 -0
- package/dist/same-booking.d.ts.map +1 -1
- package/dist/same-booking.js +13 -1
- package/dist/same-booking.js.map +1 -1
- package/dist/server.d.ts +3 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +6 -3
- package/dist/server.js.map +1 -1
- package/dist/supplier.d.ts +4 -1
- package/dist/supplier.d.ts.map +1 -1
- package/dist/supplier.js.map +1 -1
- package/dist/surface.d.ts +8 -0
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +23 -7
- package/dist/surface.js.map +1 -1
- package/dist/tools.d.ts +8 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +148 -9
- package/dist/tools.js.map +1 -1
- package/dist/trip.d.ts +18 -2
- package/dist/trip.d.ts.map +1 -1
- package/dist/trip.js +27 -1
- package/dist/trip.js.map +1 -1
- package/dist/types.d.ts +11 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -14
- package/dist/payments/fake-gateway.d.ts +0 -43
- package/dist/payments/fake-gateway.d.ts.map +0 -1
- package/dist/payments/fake-gateway.js +0 -135
- package/dist/payments/fake-gateway.js.map +0 -1
package/dist/huazhu/backend.js
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
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
|
|
2043
|
-
*
|
|
2044
|
-
*
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
|
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
|
|
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
|
|
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 (
|
|
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
|
}
|