@curless/hotel-storefront 0.72.0 → 0.72.1
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/account/index.d.ts +1 -0
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +31 -7
- package/dist/account/index.js.map +1 -1
- package/dist/otaless/booking.d.ts +3 -0
- package/dist/otaless/booking.d.ts.map +1 -1
- package/dist/otaless/booking.js +236 -81
- package/dist/otaless/booking.js.map +1 -1
- package/dist/otaless/client.d.ts +54 -12
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js +60 -1
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/fake.d.ts +29 -7
- package/dist/otaless/fake.d.ts.map +1 -1
- package/dist/otaless/fake.js +59 -15
- package/dist/otaless/fake.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
|
@@ -170,6 +170,7 @@ export type OrderRecord = {
|
|
|
170
170
|
* ⚠️ THE GROUP'S TERMS AGREED FOR THE GUEST: 8 asked for them with nothing to
|
|
171
171
|
* show, and was sent once more with `termsAccepted` (`proceedWithoutGroupConfirm`,
|
|
172
172
|
* robin 11-12 - the dev backend's alone): `groupTermsAutoAccepted` on the booking.
|
|
173
|
+
* ⚠️ NOT DONE SINCE 0.72.1 - an order kept from before is still said so.
|
|
173
174
|
*/
|
|
174
175
|
autoAccepted?: true;
|
|
175
176
|
/**
|
|
@@ -436,6 +437,8 @@ export type RefundPreview = {
|
|
|
436
437
|
};
|
|
437
438
|
/** How long a refund's preview can be sent back (总线程's review of 0.63.0, B). */
|
|
438
439
|
export declare const REFUND_PREVIEW_MS: number;
|
|
440
|
+
/** How long the 7 before the group's terms stands for the 7 before the order, on a 10014 (`pricedRecently`). */
|
|
441
|
+
export declare const PRICED_IN_MS = 30000;
|
|
439
442
|
/**
|
|
440
443
|
* A refusal for want of a sign-in - `sign-in`, `signed-out`, `session-expired`
|
|
441
444
|
* - with the groups it is at (`providerCode`s): the tools and the card name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking.d.ts","sourceRoot":"","sources":["../../src/otaless/booking.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,eAAe,CAAC;AAI/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,OAAO,EAEP,aAAa,EACb,mBAAmB,EACnB,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EAEL,IAAI,EACJ,SAAS,EACT,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,IAAI,EAGT,KAAK,aAAa,EAIlB,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"booking.d.ts","sourceRoot":"","sources":["../../src/otaless/booking.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,eAAe,CAAC;AAI/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,OAAO,EAEP,aAAa,EACb,mBAAmB,EACnB,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EAEL,IAAI,EACJ,SAAS,EACT,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,IAAI,EAGT,KAAK,aAAa,EAIlB,KAAK,IAAI,EAKT,KAAK,SAAS,EAGf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA2C1C;;;;GAIG;AACH,eAAO,MAAM,QAAQ,QAAc,CAAC;AACpC,kEAAkE;AAClE,eAAO,MAAM,eAAe,QAAkB,CAAC;AAC/C,gFAAgF;AAChF,eAAO,MAAM,eAAe,QAAS,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EF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAKjD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,KAAK;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,KAC7D,MAAM,GAAG,SAAS,GAAG,SAOvB,CAAC;AAeF,eAAO,MAAM,qBAAqB,GAAI,MAAM,WAAW;2BAqpD7C,SAAS,SACR,KAAK,OACP,QAAQ,KACZ,OAAO,CAAC,oBAAoB,CAAC;wBAykBC,QAAQ,UAAU,MAAM,KAAG,OAAO,CAAC,WAAW,CAAC;uBAuBhD,MAAM,OAAO,QAAQ,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;+BAUxE,MAAM,OACN,QAAQ,KACZ,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC;yBAsEtC,MAAM,OACN,QAAQ,WACJ,MAAM,KACd,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;;CA2P3B,CAAC"}
|
package/dist/otaless/booking.js
CHANGED
|
@@ -4,7 +4,7 @@ import { guestTooLong } from '../backend.js';
|
|
|
4
4
|
import { nights as nightsOf } from '../dates.js';
|
|
5
5
|
import { movedSince } from '../huazhu/backend.js';
|
|
6
6
|
import { decimalsOf, minorFactor, money, toMinor } from '../money.js';
|
|
7
|
-
import { CHANNEL_SESSION_EXPIRED, NOT_SIGNED_IN, OtalessBusy, OtalessError, REPEAT_SUBMIT, SESSION_ID, forTheLog, } from './client.js';
|
|
7
|
+
import { CHANNEL_SESSION_EXPIRED, NOT_SIGNED_IN, OtalessBusy, OtalessError, REPEAT_SUBMIT, SESSION_ID, forTheLog, isBookingTerms, } from './client.js';
|
|
8
8
|
// Booking on the Otaless hotel backend: items 8-16 of its document of
|
|
9
9
|
// 2026-11-10. Since 2026-11-11 the order is 8 `booking/create` - the backend's
|
|
10
10
|
// own answer to questions #56: 「booking/create 就行,checkout 所有的 api 不需要」
|
|
@@ -17,6 +17,10 @@ import { CHANNEL_SESSION_EXPIRED, NOT_SIGNED_IN, OtalessBusy, OtalessError, REPE
|
|
|
17
17
|
// group sent them with the room, word for word - are shown before anything
|
|
18
18
|
// is ordered, and 8 is called only once the guest agreed on the card's own
|
|
19
19
|
// button or the one-time page (`acceptTerms`), never on the model's word.
|
|
20
|
+
// A group whose `/site` row says `termsRequired` (the 11-16 document, 0.72.1)
|
|
21
|
+
// is asked for its own terms by 8 itself - `termsRequired: true`, which
|
|
22
|
+
// answers them and orders nothing - and those are what the guest agrees to;
|
|
23
|
+
// only then is 8 sent again, with `termsRequired: false`, to order it.
|
|
20
24
|
// Terms the group answers the order with that are not the ones agreed hold
|
|
21
25
|
// the order's payment page back until the guest agrees to them too; not
|
|
22
26
|
// agreed, or not in `TERMS_MS`, the order is cancelled (9).
|
|
@@ -191,6 +195,8 @@ const CHECKED_PER_LOOK = 5;
|
|
|
191
195
|
export const DEFAULT_CHECKOUT_HOSTS = ['pay.discoverasr.com'];
|
|
192
196
|
/** How long a refund's preview can be sent back (总线程's review of 0.63.0, B). */
|
|
193
197
|
export const REFUND_PREVIEW_MS = 10 * 60_000;
|
|
198
|
+
/** How long the 7 before the group's terms stands for the 7 before the order, on a 10014 (`pricedRecently`). */
|
|
199
|
+
export const PRICED_IN_MS = 30_000;
|
|
194
200
|
const refusal = (code, message) => Object.assign(new Error(message), { code });
|
|
195
201
|
const signInRefusal = (code, message, groups) => Object.assign(new Error(message), { code, groups: [...groups] });
|
|
196
202
|
const num = (v) => {
|
|
@@ -635,6 +641,18 @@ export const createOtalessBookings = (deps) => {
|
|
|
635
641
|
group,
|
|
636
642
|
};
|
|
637
643
|
};
|
|
644
|
+
/**
|
|
645
|
+
* Whether `group` asks for its own terms before it is booked - its `/site` row's
|
|
646
|
+
* `termsRequired` (0.72.1; client.ts keeps it by group). `undefined`: not said.
|
|
647
|
+
*/
|
|
648
|
+
const groupTermsOf = async (group) => {
|
|
649
|
+
try {
|
|
650
|
+
return await client.termsRequired(group);
|
|
651
|
+
}
|
|
652
|
+
catch {
|
|
653
|
+
return undefined;
|
|
654
|
+
}
|
|
655
|
+
};
|
|
638
656
|
const signInFirst = (groups) => signInRefusal('sign-in', `Nothing was booked: booking at ${groups.map((g) => deps.groupOf(g).name).join(' and ')} needs the guest signed in there through their ${deps.brand} account - ask them to sign in first.`, groups);
|
|
639
657
|
/**
|
|
640
658
|
* One of this guest's orders, by its id or the code the guest quotes, with
|
|
@@ -888,7 +906,6 @@ export const createOtalessBookings = (deps) => {
|
|
|
888
906
|
const limited = (a, name) => failedStay(a, `Not sent to ${name}: too many requests just now - ask again in a minute.`, 'limited');
|
|
889
907
|
const recordOf = (a, pairs, id, code, status) => ({
|
|
890
908
|
...(a.noTerms ? { noTerms: true } : {}),
|
|
891
|
-
...(a.autoAccepted ? { stepUnsent: a.autoAccepted, autoAccepted: true } : {}),
|
|
892
909
|
id,
|
|
893
910
|
code,
|
|
894
911
|
group: a.group,
|
|
@@ -957,8 +974,12 @@ export const createOtalessBookings = (deps) => {
|
|
|
957
974
|
const g = deps.groupOf(code);
|
|
958
975
|
return { groupName: g.name, ...(g.names ? { groupNames: g.names } : {}) };
|
|
959
976
|
};
|
|
960
|
-
/**
|
|
961
|
-
|
|
977
|
+
/**
|
|
978
|
+
* The terms of one stay, for the guest to agree to before it is ordered. `askGroup`: its
|
|
979
|
+
* group's `/site` did not say whether it asks for terms of its own - agreed, 8 is sent with
|
|
980
|
+
* `termsRequired: true` (0.72.1).
|
|
981
|
+
*/
|
|
982
|
+
const termsBefore = (a, askGroup = false) => remember({
|
|
962
983
|
ref: randomBytes(18).toString('base64url'),
|
|
963
984
|
group: a.group,
|
|
964
985
|
...groupWords(a.group),
|
|
@@ -975,7 +996,11 @@ export const createOtalessBookings = (deps) => {
|
|
|
975
996
|
until: iso(now() + TERMS_MS),
|
|
976
997
|
owner: a.acct.owner,
|
|
977
998
|
key: a.acct.key,
|
|
978
|
-
ask: {
|
|
999
|
+
ask: {
|
|
1000
|
+
roomId: a.roomId,
|
|
1001
|
+
guest: a.guest,
|
|
1002
|
+
...(askGroup ? { groupTerms: 'ask' } : {}),
|
|
1003
|
+
},
|
|
979
1004
|
});
|
|
980
1005
|
/** Where what a group asks to agree to or confirm is not what the guest was shown - or nothing. */
|
|
981
1006
|
const stepOff = (asked, a, pairs) => asked.amountUnread ||
|
|
@@ -994,12 +1019,12 @@ export const createOtalessBookings = (deps) => {
|
|
|
994
1019
|
* and sent once more with the token. Without both - or asked again after the
|
|
995
1020
|
* guest did it - nothing is booked, and the log says which it was.
|
|
996
1021
|
*/
|
|
997
|
-
const groupAsked = (a, step, data, pairs
|
|
1022
|
+
const groupAsked = (a, step, data, pairs) => {
|
|
998
1023
|
const g = deps.groupOf(a.group);
|
|
999
1024
|
const what = `${step}_required`;
|
|
1000
1025
|
const code = (step === 'terms' ? 'group-terms' : 'group-confirm');
|
|
1001
1026
|
const asked = groupStepOf(step, data);
|
|
1002
|
-
if (asked && !a.groupStep) {
|
|
1027
|
+
if (asked && !a.groupStep && a.groupTerms !== 'agreed') {
|
|
1003
1028
|
const off = stepOff(asked, a, pairs);
|
|
1004
1029
|
const amountOff = off === 'another amount';
|
|
1005
1030
|
if (off) {
|
|
@@ -1038,11 +1063,11 @@ export const createOtalessBookings = (deps) => {
|
|
|
1038
1063
|
}),
|
|
1039
1064
|
};
|
|
1040
1065
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1066
|
+
// After the guest agreed to the group's own terms - 8's (0.72.1) or a step's.
|
|
1067
|
+
const agreedAlready = !!a.groupStep || a.groupTerms === 'agreed';
|
|
1068
|
+
log(agreedAlready
|
|
1069
|
+
? `[otaless] booking at ${a.group} answered ${what} again, after the guest ${step === 'terms' ? 'agreed to its terms' : 'confirmed it'} - not booked`
|
|
1070
|
+
: `[otaless] booking at ${a.group} answered ${what} with no ${step === 'terms' ? 'terms' : 'details'} and token to show the guest - not booked (questions #${step === 'terms' ? 66 : 68})`);
|
|
1046
1071
|
const again = step === 'terms'
|
|
1047
1072
|
? `${g.name} asked for its terms to be agreed to again after the guest agreed to them, so nothing was booked or charged.`
|
|
1048
1073
|
: `${g.name} asked for the booking to be confirmed again after the guest confirmed it, so nothing was booked or charged.`;
|
|
@@ -1050,7 +1075,80 @@ export const createOtalessBookings = (deps) => {
|
|
|
1050
1075
|
? `${g.name} asked for terms of its own to be agreed to, which it did not send to be shown here, so nothing was booked or charged.`
|
|
1051
1076
|
: `${g.name} asked for the booking to be confirmed in a second step, and did not send what to confirm to be shown here, so nothing was booked or charged.`;
|
|
1052
1077
|
// New codes for the card (酒店平台's next version): until then, these words.
|
|
1053
|
-
return { failed: failedStay(a,
|
|
1078
|
+
return { failed: failedStay(a, agreedAlready ? again : none, code) };
|
|
1079
|
+
};
|
|
1080
|
+
/**
|
|
1081
|
+
* 8 answered the group's own terms, and no order (`WireBookingTerms` - the 11-16 document:
|
|
1082
|
+
* asked with `termsRequired: true` at a group whose `/site` says so; robin 11-16, questions
|
|
1083
|
+
* #66). ⚠️ NEVER AGREED FOR THE GUEST (#52): its `termsPoints` and `cancellation`, word
|
|
1084
|
+
* for word, are the guest's to read and agree to themselves - the card's button or the
|
|
1085
|
+
* one-time page; agreed, the room is priced again and 8 sent once more with
|
|
1086
|
+
* `termsRequired: false`, which orders it. Not agreed: nothing more is sent.
|
|
1087
|
+
* ⚠️ NOT HANDED ON: `next` (words for a model - "ask about add-ons before the yes"), the
|
|
1088
|
+
* `summary` (to the log alone, questions #75), `acceptArgs` and `confirmToken` (how they
|
|
1089
|
+
* go back is questions #79 - not kept). For another hotel or room than the one asked,
|
|
1090
|
+
* with nothing to show, too long to show whole, or answered again after the guest agreed:
|
|
1091
|
+
* nothing is shown and nothing booked.
|
|
1092
|
+
*/
|
|
1093
|
+
const termsFrom8 = (a, w) => {
|
|
1094
|
+
const g = deps.groupOf(a.group);
|
|
1095
|
+
const guest = [a.guest.name, a.guest.email, a.guest.phone];
|
|
1096
|
+
const note = text(w.summary ?? undefined);
|
|
1097
|
+
if (note)
|
|
1098
|
+
log(`[otaless] booking at ${a.group}: the summary of its terms, kept to this log: "${summaryForLog(note, guest)}"`);
|
|
1099
|
+
const notBooked = (line, why, code) => {
|
|
1100
|
+
log(`[otaless] booking at ${a.group} answered its terms ${line} - not booked`);
|
|
1101
|
+
return { failed: failedStay(a, why, code) };
|
|
1102
|
+
};
|
|
1103
|
+
if (a.groupTerms === 'agreed')
|
|
1104
|
+
return notBooked('again, after the guest agreed to them (questions #79)', `${g.name} asked for its terms to be agreed to again after the guest agreed to them, so nothing was booked or charged.`);
|
|
1105
|
+
const tail = (id) => id.slice(id.lastIndexOf(':') + 1);
|
|
1106
|
+
const hotelSaid = text(w.unifiedHotelId);
|
|
1107
|
+
const roomSaid = text(w.unifiedRoomId);
|
|
1108
|
+
const groupSaid = text(w.providerCode)?.toLowerCase();
|
|
1109
|
+
if ((hotelSaid && tail(hotelSaid) !== tail(a.hotel.id)) ||
|
|
1110
|
+
(roomSaid && tail(roomSaid) !== tail(a.roomId)) ||
|
|
1111
|
+
(groupSaid && groupSaid !== a.group))
|
|
1112
|
+
return notBooked('for another hotel or room than the one asked', `${g.name} sent terms for another hotel or room than the one asked for, so nothing was booked or charged.`);
|
|
1113
|
+
// Word for word, each as the group wrote it - the same twice is shown once.
|
|
1114
|
+
const parts = [];
|
|
1115
|
+
for (const v of [w.termsPoints, w.cancellation]) {
|
|
1116
|
+
const t = typeof v === 'string' ? v.trim() : '';
|
|
1117
|
+
if (t && !parts.some((p) => termsKey(p) === termsKey(t)))
|
|
1118
|
+
parts.push(t);
|
|
1119
|
+
}
|
|
1120
|
+
const shown = parts.join('\n\n');
|
|
1121
|
+
if (!shown)
|
|
1122
|
+
return notBooked('with nothing to show', `${g.name} asked for its own terms to be agreed to and sent none to show here, so nothing was booked or charged.`, 'group-terms');
|
|
1123
|
+
if (shown.length > TERMS_MAX)
|
|
1124
|
+
return notBooked('too long to show whole', `${g.name}'s terms for this room are too long to show in full here, so nothing was booked or charged.`);
|
|
1125
|
+
const unsent = [
|
|
1126
|
+
w.acceptArgs !== undefined && w.acceptArgs !== null ? 'acceptArgs' : '',
|
|
1127
|
+
text(w.confirmToken ?? undefined) ? 'confirmToken' : '',
|
|
1128
|
+
].filter(Boolean);
|
|
1129
|
+
log(`[otaless] booking at ${a.group} answered its terms (${[text(w.termsPoints ?? undefined) ? 'termsPoints' : '', text(w.cancellation ?? undefined) ? 'cancellation' : ''].filter(Boolean).join(', ')}) - shown to the guest, nothing ordered${unsent.length ? `; ${unsent.join(', ')} not sent back (questions #79)` : ''}`);
|
|
1130
|
+
return {
|
|
1131
|
+
terms: remember({
|
|
1132
|
+
ref: randomBytes(18).toString('base64url'),
|
|
1133
|
+
group: a.group,
|
|
1134
|
+
...groupWords(a.group),
|
|
1135
|
+
hotelId: a.hotel.id,
|
|
1136
|
+
hotelName: a.hotel.name,
|
|
1137
|
+
...(a.hotel.names?.name ? { hotelNames: a.hotel.names.name } : {}),
|
|
1138
|
+
roomName: a.roomName,
|
|
1139
|
+
stay: a.stay,
|
|
1140
|
+
rooms: a.rooms,
|
|
1141
|
+
total: a.total,
|
|
1142
|
+
text: shown,
|
|
1143
|
+
source: 'booking',
|
|
1144
|
+
more: true,
|
|
1145
|
+
askedByGroup: 'terms',
|
|
1146
|
+
until: iso(now() + TERMS_MS),
|
|
1147
|
+
owner: a.acct.owner,
|
|
1148
|
+
key: a.acct.key,
|
|
1149
|
+
ask: { roomId: a.roomId, guest: a.guest, groupTerms: 'answered', parts },
|
|
1150
|
+
}),
|
|
1151
|
+
};
|
|
1054
1152
|
};
|
|
1055
1153
|
/**
|
|
1056
1154
|
* The terms an order is held back for (总线程 11-11, D): those kept - or,
|
|
@@ -1339,8 +1437,31 @@ export const createOtalessBookings = (deps) => {
|
|
|
1339
1437
|
...(row.currency !== undefined ? { currency: row.currency } : {}),
|
|
1340
1438
|
}, pairs);
|
|
1341
1439
|
};
|
|
1440
|
+
/**
|
|
1441
|
+
* An order's terms (8's `cancelPolicy`) are what the guest agreed to: the same words, but
|
|
1442
|
+
* for spacing and punctuation - or, agreed to as 8 answered the group's own terms (0.72.1),
|
|
1443
|
+
* one of the parts they were shown, WHOLE (its `cancellation` alone, say). ⚠️ NEVER A PIECE
|
|
1444
|
+
* OF ONE: "one night is retained" cut out of "after 18:00 the day before, one night is
|
|
1445
|
+
* retained" drops the condition the guest agreed to.
|
|
1446
|
+
*/
|
|
1447
|
+
const agreedTo = (said, a) => {
|
|
1448
|
+
const k = termsKey(said);
|
|
1449
|
+
if (k === termsKey(a.agreed))
|
|
1450
|
+
return true;
|
|
1451
|
+
if (a.groupStep?.step === 'terms' && k === termsKey(a.groupStep.text))
|
|
1452
|
+
return true;
|
|
1453
|
+
return a.groupTerms === 'agreed' && (a.agreedParts ?? []).some((p) => termsKey(p) === k);
|
|
1454
|
+
};
|
|
1342
1455
|
/** What 8 answered, settled: an order to hand on, one held for new terms, or none. */
|
|
1343
1456
|
const settle = async (a, w, pairs) => {
|
|
1457
|
+
// ⚠️ THE GROUP'S TERMS, NOT AN ORDER (0.72.1): 8 asked with `termsRequired: true`
|
|
1458
|
+
// answers them with no order id - never an order "being looked into" (核对中) below.
|
|
1459
|
+
if (isBookingTerms(w))
|
|
1460
|
+
return termsFrom8(a, w);
|
|
1461
|
+
return settleOrder(a, w, pairs);
|
|
1462
|
+
};
|
|
1463
|
+
/** What 8 answered with - an order, a refusal or nothing - settled (`settle`). */
|
|
1464
|
+
const settleOrder = async (a, w, pairs) => {
|
|
1344
1465
|
const g = deps.groupOf(a.group);
|
|
1345
1466
|
// ⚠️ 8's `summary` IS THE BACKEND'S OWN NOTE - TO THE LOG ALONE (0.71.1, 总线程 11-13):
|
|
1346
1467
|
// Atour's said "未检测到你名下可用的 VCC … 用 ?api_key=<你的 sk_test> 重连 … 会员:<name>
|
|
@@ -1369,7 +1490,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1369
1490
|
// Terms of its own to agree to, and no order (questions #66).
|
|
1370
1491
|
const step = /TERMS/.test(status) ? 'terms' : stepAsked(status);
|
|
1371
1492
|
if (step)
|
|
1372
|
-
return groupAsked(a, step, w, pairs
|
|
1493
|
+
return groupAsked(a, step, w, pairs);
|
|
1373
1494
|
// Something may be held, under a number we were not told: kept to look for (12).
|
|
1374
1495
|
const r = recordOf(a, pairs, `pending:${randomBytes(8).toString('hex')}`, '', 'unconfirmed');
|
|
1375
1496
|
put(r);
|
|
@@ -1488,17 +1609,32 @@ export const createOtalessBookings = (deps) => {
|
|
|
1488
1609
|
r.stepUnsent = step;
|
|
1489
1610
|
log(`[otaless] booking ${forTheLog(id)} at ${a.group} answered ${step}_required with nothing to ${step === 'terms' ? 'agree to' : 'confirm'} and no token - handed on with its order, the checks passed (proceedWithoutGroupConfirm; questions #${q})`);
|
|
1490
1611
|
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1612
|
+
// ⚠️ ORDERED WHEN ITS TERMS WERE ASKED FOR, NOTHING AGREED YET (0.72.1): 8 sent with
|
|
1613
|
+
// `termsRequired: true` made the order - a group whose `/site` said it asks for terms
|
|
1614
|
+
// and then did not. The order's own terms - or the room's - are the guest's to agree to
|
|
1615
|
+
// before its page is handed on; with none to show, it is cancelled.
|
|
1616
|
+
// (A room with no terms ordered at once - `noTerms`, proceedWithoutGroupConfirm - is not.)
|
|
1617
|
+
const unagreed = a.groupTerms === 'ask' && !a.agreed && !a.noTerms;
|
|
1618
|
+
const toAgree = unagreed
|
|
1619
|
+
? (said ?? text(a.roomTerms))
|
|
1620
|
+
: said && !agreedTo(said, a)
|
|
1621
|
+
? said
|
|
1622
|
+
: undefined;
|
|
1623
|
+
if (unagreed && !toAgree) {
|
|
1624
|
+
log(`[otaless] booking ${forTheLog(id)} at ${a.group} was made when its terms were asked for, with no terms for the guest to agree to - cancelled (questions #79)`);
|
|
1625
|
+
return letGo(a, r, 'terms');
|
|
1626
|
+
}
|
|
1627
|
+
if (toAgree) {
|
|
1494
1628
|
// ⚠️ NOT THE TERMS AGREED TO: the order stands, its payment page is held
|
|
1495
1629
|
// back until the guest agrees to these too - not agreed, or not in time,
|
|
1496
1630
|
// it is cancelled.
|
|
1497
|
-
r.terms =
|
|
1631
|
+
r.terms = toAgree;
|
|
1498
1632
|
r.termsNew = true;
|
|
1499
1633
|
r.held = { until: iso(now() + TERMS_MS) };
|
|
1500
1634
|
put(r);
|
|
1501
|
-
log(
|
|
1635
|
+
log(unagreed
|
|
1636
|
+
? `[otaless] booking ${forTheLog(id)} at ${a.group} was made when its terms were asked for (termsRequired) - its payment page held back for the guest to agree to its terms (questions #79)`
|
|
1637
|
+
: `[otaless] booking ${forTheLog(id)} at ${a.group} came with other terms than the guest agreed to - its payment page held back`);
|
|
1502
1638
|
holdFor(r, a.acct.key);
|
|
1503
1639
|
const t = termsOfHeld(r, a.acct);
|
|
1504
1640
|
return t ? { terms: t } : { booked: toBooking(r) };
|
|
@@ -1508,6 +1644,30 @@ export const createOtalessBookings = (deps) => {
|
|
|
1508
1644
|
put(r);
|
|
1509
1645
|
return { booked: toBooking(r) };
|
|
1510
1646
|
};
|
|
1647
|
+
/**
|
|
1648
|
+
* ⚠️ THE 7 BEFORE THE GROUP'S TERMS, FOR THE 7 BEFORE THE ORDER (0.72.1): a guest who
|
|
1649
|
+
* agrees within the backend's `@RepeatSubmit` window has the same 7 refused (10014) -
|
|
1650
|
+
* the same member's same room, nights, adults and rooms priced in their session a moment
|
|
1651
|
+
* ago is that price, as `recentQuote` is for the price shown (0.71.2). Only on a 10014,
|
|
1652
|
+
* only `PRICED_IN_MS`, by the sign-in's token - in memory alone.
|
|
1653
|
+
*/
|
|
1654
|
+
const pricedIn = new Map();
|
|
1655
|
+
const pricedKey = (a, token) => `${hash(token)}|${a.hotel.id}|${a.roomId}|${a.stay.checkIn}|${a.stay.checkOut}|${a.stay.guests}|${a.rooms}`;
|
|
1656
|
+
const pricedJustNow = (a, token, data) => {
|
|
1657
|
+
const k = pricedKey(a, token);
|
|
1658
|
+
pricedIn.delete(k);
|
|
1659
|
+
pricedIn.set(k, { at: now(), data });
|
|
1660
|
+
while (pricedIn.size > PENDING_MAX) {
|
|
1661
|
+
const first = pricedIn.keys().next().value;
|
|
1662
|
+
if (first === undefined)
|
|
1663
|
+
break;
|
|
1664
|
+
pricedIn.delete(first);
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
const pricedRecently = (a, token) => {
|
|
1668
|
+
const hit = pricedIn.get(pricedKey(a, token));
|
|
1669
|
+
return hit && now() - hit.at <= PRICED_IN_MS ? hit.data : undefined;
|
|
1670
|
+
};
|
|
1511
1671
|
class Moved extends Error {
|
|
1512
1672
|
}
|
|
1513
1673
|
class NotPriced extends Error {
|
|
@@ -1531,12 +1691,8 @@ export const createOtalessBookings = (deps) => {
|
|
|
1531
1691
|
let pairs;
|
|
1532
1692
|
/** What 8 itself threw, if it did: only that may have made an order. */
|
|
1533
1693
|
let fromBook;
|
|
1534
|
-
/** The step 8 was sent once more for, with `termsAccepted` - see `again`. */
|
|
1535
|
-
let autoAccepted;
|
|
1536
1694
|
/** A refusal for a step naming an order we keep already (`knownNamed`) - see `madeIn`. */
|
|
1537
1695
|
let namedKnown;
|
|
1538
|
-
/** This stay as it was asked, and - once sent again - as agreed for the guest. */
|
|
1539
|
-
const as = () => (autoAccepted ? { ...a, autoAccepted } : a);
|
|
1540
1696
|
let w;
|
|
1541
1697
|
try {
|
|
1542
1698
|
w = await withSession(a.acct, a.who, async (cred) => {
|
|
@@ -1556,11 +1712,15 @@ export const createOtalessBookings = (deps) => {
|
|
|
1556
1712
|
// asked once more after the pause, and a second 10014 is the group's "wait a moment".
|
|
1557
1713
|
try {
|
|
1558
1714
|
priced = await ask('once');
|
|
1715
|
+
pricedJustNow(a, cred.token, priced.data);
|
|
1559
1716
|
}
|
|
1560
1717
|
catch (err) {
|
|
1561
1718
|
if (!isCode(err, REPEAT_SUBMIT))
|
|
1562
1719
|
throw notPriced(err);
|
|
1563
|
-
|
|
1720
|
+
// The 7 before the group's terms (0.72.1) a moment ago, in this same sign-in - the
|
|
1721
|
+
// guest agreed quickly - or the price the guest was shown.
|
|
1722
|
+
const shown = pricedRecently(a, cred.token) ??
|
|
1723
|
+
deps.recentQuote?.(a.hotel, a.roomId, a.stay, a.rooms, cred.token);
|
|
1564
1724
|
if (shown) {
|
|
1565
1725
|
priced = { data: shown };
|
|
1566
1726
|
log(`[otaless] booking at ${a.group}: 7 answered 10014 - the same quote went in a moment ago; the price the guest was shown then, under the same sign-in, is the one booked at (questions #58)`);
|
|
@@ -1593,6 +1753,9 @@ export const createOtalessBookings = (deps) => {
|
|
|
1593
1753
|
checkIn: a.stay.checkIn,
|
|
1594
1754
|
checkOut: a.stay.checkOut,
|
|
1595
1755
|
roomCount: a.rooms,
|
|
1756
|
+
// 8's own two steps (0.72.1): the group's terms asked for, or - agreed by the
|
|
1757
|
+
// guest themselves - the order. Not sent at a group that asks for no terms.
|
|
1758
|
+
...(a.groupTerms ? { termsRequired: a.groupTerms === 'ask' } : {}),
|
|
1596
1759
|
// Only after the guest agreed to the terms 8 asked for (questions #66).
|
|
1597
1760
|
...(a.groupStep?.step === 'terms'
|
|
1598
1761
|
? { termsToken: a.groupStep.token, termsAccepted: true }
|
|
@@ -1647,53 +1810,11 @@ export const createOtalessBookings = (deps) => {
|
|
|
1647
1810
|
status: /TERMS/.test(status) || stepAsked(status) ? order.status : String(msg),
|
|
1648
1811
|
};
|
|
1649
1812
|
};
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
* same session, with `termsAccepted` (item 13's names, borrowed).
|
|
1656
|
-
*/
|
|
1657
|
-
const unshown = (step, data) => step && deps.proceedWithoutGroupConfirm && !a.groupStep && !groupStepOf(step, data)
|
|
1658
|
-
? step
|
|
1659
|
-
: undefined;
|
|
1660
|
-
const again = async (step) => {
|
|
1661
|
-
autoAccepted = step;
|
|
1662
|
-
fromBook = undefined;
|
|
1663
|
-
log(`[otaless] booking at ${a.group}: 8 answered ${step}_required with nothing to show and no order - sent once more with termsAccepted (proceedWithoutGroupConfirm, robin 11-12; questions #${step === 'terms' ? 66 : 68})`);
|
|
1664
|
-
return send({
|
|
1665
|
-
...body,
|
|
1666
|
-
termsAccepted: true,
|
|
1667
|
-
extraParams: { terms_accepted: true, confirmed: true },
|
|
1668
|
-
});
|
|
1669
|
-
};
|
|
1670
|
-
let booked;
|
|
1671
|
-
try {
|
|
1672
|
-
booked = await send(body);
|
|
1673
|
-
}
|
|
1674
|
-
catch (err) {
|
|
1675
|
-
if (err === namedKnown?.err)
|
|
1676
|
-
throw err;
|
|
1677
|
-
const step = err instanceof OtalessError
|
|
1678
|
-
? unshown(stepAsked(err.answer?.msg), err.answer?.data)
|
|
1679
|
-
: undefined;
|
|
1680
|
-
if (!step)
|
|
1681
|
-
throw err;
|
|
1682
|
-
booked = await again(step);
|
|
1683
|
-
}
|
|
1684
|
-
const first = booked.data;
|
|
1685
|
-
const said = String(first?.status ?? '')
|
|
1686
|
-
.trim()
|
|
1687
|
-
.toUpperCase();
|
|
1688
|
-
if (!autoAccepted &&
|
|
1689
|
-
first &&
|
|
1690
|
-
!text(first.unifiedOrderId) &&
|
|
1691
|
-
first.success !== false &&
|
|
1692
|
-
!text(first.errorMessage ?? undefined)) {
|
|
1693
|
-
const step = unshown(/TERMS/.test(said) ? 'terms' : stepAsked(said), first);
|
|
1694
|
-
if (step)
|
|
1695
|
-
booked = await again(step);
|
|
1696
|
-
}
|
|
1813
|
+
// ⚠️ NEVER SENT AGAIN FOR THE GUEST (0.72.1): the second 8 "agreed" with
|
|
1814
|
+
// `termsAccepted` - for a step asked with nothing to show - is gone. The backend took
|
|
1815
|
+
// no such field (11-12, questions #66), and a group that asks for terms now answers
|
|
1816
|
+
// them itself (`termsRequired`); a step asked with nothing to show is not booked.
|
|
1817
|
+
const booked = await send(body);
|
|
1697
1818
|
const back = booked.session ?? priced.session;
|
|
1698
1819
|
return { data: booked.data, ...(back ? { session: back } : {}) };
|
|
1699
1820
|
});
|
|
@@ -1718,30 +1839,28 @@ export const createOtalessBookings = (deps) => {
|
|
|
1718
1839
|
// repeat of one that went in a moment ago (10014) - may have made it.
|
|
1719
1840
|
// Kept to look for in the group's order list (12), said as not known.
|
|
1720
1841
|
if (err === fromBook && (unanswered(err) || isCode(err, REPEAT_SUBMIT))) {
|
|
1721
|
-
|
|
1722
|
-
// (总线程's review of 0.68.0, P3); its booking says so like any other.
|
|
1723
|
-
const r = recordOf(as(), pairs ?? { orig: a.total }, `pending:${randomBytes(8).toString('hex')}`, '', 'unconfirmed');
|
|
1842
|
+
const r = recordOf(a, pairs ?? { orig: a.total }, `pending:${randomBytes(8).toString('hex')}`, '', 'unconfirmed');
|
|
1724
1843
|
put(r);
|
|
1725
1844
|
return { booked: toBooking(r) };
|
|
1726
1845
|
}
|
|
1727
1846
|
if (namedKnown && err === namedKnown.err)
|
|
1728
|
-
return untouched(
|
|
1847
|
+
return untouched(a, namedKnown.id, 'refused');
|
|
1729
1848
|
// ⚠️ 8 REFUSED FOR TERMS (robin 11-11 18:30, Ascott: code 500 "terms_required").
|
|
1730
1849
|
const step = err === fromBook && err instanceof OtalessError ? stepAsked(err.answer?.msg) : undefined;
|
|
1731
1850
|
if (step)
|
|
1732
|
-
return groupAsked(
|
|
1851
|
+
return groupAsked(a, step, err instanceof OtalessError ? err.answer?.data : undefined, pairs ?? { orig: a.total });
|
|
1733
1852
|
const ref = err === fromBook && err instanceof OtalessError
|
|
1734
|
-
? refusalOf(
|
|
1853
|
+
? refusalOf(a, err.answer?.data, err.answer?.msg)
|
|
1735
1854
|
: undefined;
|
|
1736
1855
|
if (ref)
|
|
1737
|
-
return refusedWithOrder(
|
|
1856
|
+
return refusedWithOrder(a, ref, pairs ?? { orig: a.total });
|
|
1738
1857
|
if (err instanceof OtalessError)
|
|
1739
1858
|
return {
|
|
1740
1859
|
failed: failedStay(a, `${g.name} did not take the booking, so nothing was booked or charged.`),
|
|
1741
1860
|
};
|
|
1742
1861
|
throw err;
|
|
1743
1862
|
}
|
|
1744
|
-
return settle(
|
|
1863
|
+
return settle(a, w, pairs ?? { orig: a.total });
|
|
1745
1864
|
};
|
|
1746
1865
|
/**
|
|
1747
1866
|
* An order row that could be an order 8 did not answer for: of the group,
|
|
@@ -2002,12 +2121,41 @@ export const createOtalessBookings = (deps) => {
|
|
|
2002
2121
|
guest: g0,
|
|
2003
2122
|
total: line.total,
|
|
2004
2123
|
};
|
|
2124
|
+
// ⚠️ WHETHER THE GROUP ASKS FOR ITS OWN TERMS: its `/site` row (the 11-16 document,
|
|
2125
|
+
// 0.72.1) - `true`: 8 itself is asked for them now (`termsRequired: true`, nothing is
|
|
2126
|
+
// ordered), and they - not the room's - are what the guest agrees to; `false`: the
|
|
2127
|
+
// room's terms, and one 8 orders it, as before; not said (not listed, a backend before
|
|
2128
|
+
// the document, `/site` not read since): the room's terms first, and 8 is then sent
|
|
2129
|
+
// with `termsRequired: true` all the same - a group that asks for terms answers them,
|
|
2130
|
+
// and any other orders it, as the document has it.
|
|
2131
|
+
const needsTerms = await groupTermsOf(group);
|
|
2132
|
+
if (needsTerms) {
|
|
2133
|
+
inFlight.add(lockKey);
|
|
2134
|
+
try {
|
|
2135
|
+
const out = await place({ ...ask, agreed: '', roomTerms: agreed, groupTerms: 'ask' });
|
|
2136
|
+
if (out.booked)
|
|
2137
|
+
booked.push(out.booked);
|
|
2138
|
+
if (out.failed)
|
|
2139
|
+
failed.push(out.failed);
|
|
2140
|
+
if (out.terms)
|
|
2141
|
+
terms.push(out.terms);
|
|
2142
|
+
}
|
|
2143
|
+
finally {
|
|
2144
|
+
inFlight.delete(lockKey);
|
|
2145
|
+
}
|
|
2146
|
+
continue;
|
|
2147
|
+
}
|
|
2148
|
+
const unsaid = needsTerms === undefined;
|
|
2005
2149
|
// No terms for this room to agree to, and the deployment lets that go on
|
|
2006
2150
|
// (robin 11-12 「条款没有也让走下一步」): ordered now - said on the booking.
|
|
2007
2151
|
if (!agreed && deps.proceedWithoutGroupConfirm) {
|
|
2008
2152
|
inFlight.add(lockKey);
|
|
2009
2153
|
try {
|
|
2010
|
-
const out = await place({
|
|
2154
|
+
const out = await place({
|
|
2155
|
+
...ask,
|
|
2156
|
+
noTerms: true,
|
|
2157
|
+
...(unsaid ? { groupTerms: 'ask' } : {}),
|
|
2158
|
+
});
|
|
2011
2159
|
if (out.booked)
|
|
2012
2160
|
booked.push(out.booked);
|
|
2013
2161
|
if (out.failed)
|
|
@@ -2021,7 +2169,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
2021
2169
|
continue;
|
|
2022
2170
|
}
|
|
2023
2171
|
// ⚠️ NOTHING IS ORDERED YET (§15.1): the terms first, for the guest to agree to.
|
|
2024
|
-
terms.push(termsBefore(ask));
|
|
2172
|
+
terms.push(termsBefore(ask, unsaid));
|
|
2025
2173
|
}
|
|
2026
2174
|
return {
|
|
2027
2175
|
booked,
|
|
@@ -2107,6 +2255,13 @@ export const createOtalessBookings = (deps) => {
|
|
|
2107
2255
|
...(ask.token
|
|
2108
2256
|
? { groupStep: { step: ask.step ?? 'terms', text: p.text, token: ask.token } }
|
|
2109
2257
|
: {}),
|
|
2258
|
+
// 8's own two steps (0.72.1): the group's terms as 8 answered them, agreed - the
|
|
2259
|
+
// order now; or the room's, at a group whose `/site` did not say - 8 asks for them.
|
|
2260
|
+
...(ask.groupTerms === 'answered'
|
|
2261
|
+
? { groupTerms: 'agreed', ...(ask.parts ? { agreedParts: ask.parts } : {}) }
|
|
2262
|
+
: ask.groupTerms === 'ask'
|
|
2263
|
+
? { groupTerms: 'ask' }
|
|
2264
|
+
: {}),
|
|
2110
2265
|
guest: ask.guest,
|
|
2111
2266
|
total: p.total,
|
|
2112
2267
|
});
|