@curless/hotel-storefront 0.73.1 → 0.74.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/account/index.d.ts +11 -6
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +153 -26
- package/dist/account/index.js.map +1 -1
- package/dist/account/pages.d.ts +5 -1
- package/dist/account/pages.d.ts.map +1 -1
- package/dist/account/pages.js +11 -7
- package/dist/account/pages.js.map +1 -1
- package/dist/account/store.d.ts +4 -2
- package/dist/account/store.d.ts.map +1 -1
- package/dist/account/store.js.map +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/otaless/booking.d.ts +14 -0
- package/dist/otaless/booking.d.ts.map +1 -1
- package/dist/otaless/booking.js +208 -115
- package/dist/otaless/booking.js.map +1 -1
- package/dist/otaless/client.d.ts +53 -24
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js +10 -7
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/fake.d.ts +32 -1
- package/dist/otaless/fake.d.ts.map +1 -1
- package/dist/otaless/fake.js +84 -22
- package/dist/otaless/fake.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +5 -2
- package/dist/server.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +13 -7
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.generated.js","sourceRoot":"","sources":["../src/card.generated.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,wEAAwE;AACxE,gFAAgF;AAChF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,eAAe,GAAW,MAAM,CAAC,IAAI,CAChD,
|
|
1
|
+
{"version":3,"file":"card.generated.js","sourceRoot":"","sources":["../src/card.generated.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,wEAAwE;AACxE,gFAAgF;AAChF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,eAAe,GAAW,MAAM,CAAC,IAAI,CAChD,k0++CAAk0++C,EACl0++C,QAAQ,CACT,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAEnB,6GAA6G;AAC7G,MAAM,CAAC,MAAM,qBAAqB,GAChC,kEAAkE,CAAC;AAErE,0GAA0G;AAC1G,MAAM,CAAC,MAAM,qBAAqB,GAChC,iLAAiL,CAAC"}
|
|
@@ -52,6 +52,13 @@ export declare const CLOSED_PAYMENT_STATUSES: ReadonlySet<string>;
|
|
|
52
52
|
export declare const realOrderCode: (code: string | undefined) => code is string;
|
|
53
53
|
/** The longest terms shown word for word - longer is refused rather than cut. */
|
|
54
54
|
export declare const TERMS_MAX = 50000;
|
|
55
|
+
/**
|
|
56
|
+
* 8's `confirmToken` (step 1 of the 11-17 document - a UUID in its example): printable, no
|
|
57
|
+
* spaces, and not long - one that is not goes nowhere.
|
|
58
|
+
*/
|
|
59
|
+
export declare const STEP_TOKEN: RegExp;
|
|
60
|
+
/** ⚠️ A `confirmToken` ON THE LOG: its first six characters, never more (总线程 11-17). */
|
|
61
|
+
export declare const tokenForLog: (token: string) => string;
|
|
55
62
|
/**
|
|
56
63
|
* The payment pages a guest may be sent to, until a deployment says otherwise:
|
|
57
64
|
* the group checkout host of 13's example (`pay.discoverasr.com`). Exact host
|
|
@@ -589,6 +596,13 @@ export declare const cancelOutcome: (out: {
|
|
|
589
596
|
success?: boolean;
|
|
590
597
|
status?: string;
|
|
591
598
|
} | null | undefined) => "done" | "refused" | "unknown";
|
|
599
|
+
/**
|
|
600
|
+
* The backend refusing because the guest's membership of that group is not linked - or its
|
|
601
|
+
* channel not signed in - in its own words (0.74.0, robin 11-17: 「未绑定 / 未登录渠道」). Its
|
|
602
|
+
* codes for it are questions #94; ⚠️ NOT ITS 4012 (`CHANNEL_SESSION_EXPIRED`, answered with a
|
|
603
|
+
* new handshake first) NOR 401 (the account's own sign-in). Words we cannot read are not it.
|
|
604
|
+
*/
|
|
605
|
+
export declare const unlinkedSaid: (err: unknown) => boolean;
|
|
592
606
|
export declare const createOtalessBookings: (deps: BookingDeps) => {
|
|
593
607
|
requestBooking: (trip: TripDraft, guest: Guest, who: Identity) => Promise<OtalessBookingResult>;
|
|
594
608
|
listBookings: (who: Identity, limit?: number) => Promise<BookingList>;
|
|
@@ -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,
|
|
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,EAIL,KAAK,IAAI,EAGT,KAAK,aAAa,EAIlB,KAAK,IAAI,EAMT,KAAK,SAAS,EAIf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,EAAE,MAA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C"}
|
package/dist/otaless/booking.js
CHANGED
|
@@ -18,9 +18,11 @@ import { CHANNEL_SESSION_EXPIRED, NOT_SIGNED_IN, OtalessBusy, OtalessError, REPE
|
|
|
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
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 -
|
|
22
|
-
//
|
|
23
|
-
// only then
|
|
21
|
+
// is asked for its own terms by 8 itself - its step 1, which answers them
|
|
22
|
+
// with a `confirmToken` and orders nothing - and those are what the guest
|
|
23
|
+
// agrees to; only then are its steps 2 (`termsAccepted`) and 3
|
|
24
|
+
// (`checkoutPayment`) sent with that token, to order it (the 11-17
|
|
25
|
+
// document, 0.74.0 - `place`).
|
|
24
26
|
// Terms the group answers the order with that are not the ones agreed hold
|
|
25
27
|
// the order's payment page back until the guest agrees to them too; not
|
|
26
28
|
// agreed, or not in `TERMS_MS`, the order is cancelled (9).
|
|
@@ -178,6 +180,13 @@ const REASON_MAX = 200;
|
|
|
178
180
|
const SESSIONS_MAX = 20_000;
|
|
179
181
|
const PENDING_MAX = 2_000;
|
|
180
182
|
const PENDING_PER_ACCOUNT = 5;
|
|
183
|
+
/**
|
|
184
|
+
* 8's `confirmToken` (step 1 of the 11-17 document - a UUID in its example): printable, no
|
|
185
|
+
* spaces, and not long - one that is not goes nowhere.
|
|
186
|
+
*/
|
|
187
|
+
export const STEP_TOKEN = /^[\x21-\x7e]{1,512}$/;
|
|
188
|
+
/** ⚠️ A `confirmToken` ON THE LOG: its first six characters, never more (总线程 11-17). */
|
|
189
|
+
export const tokenForLog = (token) => `${token.slice(0, 6)}…`;
|
|
181
190
|
/** The orders checked on one look at the bookings - newest first; the rest wait for the next look. */
|
|
182
191
|
const CHECKED_PER_LOOK = 5;
|
|
183
192
|
/**
|
|
@@ -622,6 +631,21 @@ export const cancelOutcome = (out) => {
|
|
|
622
631
|
return 'unknown';
|
|
623
632
|
return CANCELLED_STATUSES.has(s) ? 'done' : 'refused';
|
|
624
633
|
};
|
|
634
|
+
/**
|
|
635
|
+
* The backend refusing because the guest's membership of that group is not linked - or its
|
|
636
|
+
* channel not signed in - in its own words (0.74.0, robin 11-17: 「未绑定 / 未登录渠道」). Its
|
|
637
|
+
* codes for it are questions #94; ⚠️ NOT ITS 4012 (`CHANNEL_SESSION_EXPIRED`, answered with a
|
|
638
|
+
* new handshake first) NOR 401 (the account's own sign-in). Words we cannot read are not it.
|
|
639
|
+
*/
|
|
640
|
+
export const unlinkedSaid = (err) => {
|
|
641
|
+
if (!(err instanceof OtalessError) || err instanceof OtalessBusy)
|
|
642
|
+
return false;
|
|
643
|
+
if (err.backendCode === CHANNEL_SESSION_EXPIRED || err.backendCode === NOT_SIGNED_IN)
|
|
644
|
+
return false;
|
|
645
|
+
const msg = String(err.answer?.msg ?? '');
|
|
646
|
+
return (/(未|没有?)(绑定|关联)(该|此|这个)?(渠道|集团|会员)|(渠道|集团)(会员)?(未|没有?)(绑定|关联|登录)|未登录(该|此|这个)?渠道|请先(绑定|关联|登录)(该|此|这个)?(渠道|集团)|渠道凭据(不存在|为空|缺失)/.test(msg) ||
|
|
647
|
+
/\b(channel|membership|provider)\b[^.]{0,40}\b(not (linked|bound|signed in)|unlinked|unbound)\b|\bnot (linked|bound) to\b/i.test(msg));
|
|
648
|
+
};
|
|
625
649
|
const isCode = (err, code) => err instanceof OtalessError && !(err instanceof OtalessBusy) && err.backendCode === code;
|
|
626
650
|
/**
|
|
627
651
|
* Sent, and no answer it could be read by: whether it was done is not known -
|
|
@@ -689,7 +713,27 @@ export const createOtalessBookings = (deps) => {
|
|
|
689
713
|
return undefined;
|
|
690
714
|
}
|
|
691
715
|
};
|
|
692
|
-
|
|
716
|
+
/**
|
|
717
|
+
* ⚠️ NOT SIGNED IN TO THE ACCOUNT ITSELF (0.74.0, robin 11-17: 「登陆平台就好,酒店预订不需要每次
|
|
718
|
+
* 登陆」): the only thing checked before a booking. A group linked or not is the backend's to
|
|
719
|
+
* say (`linkFirst`) - no group is asked to be linked before it is booked. No groups: no link.
|
|
720
|
+
*/
|
|
721
|
+
const signInFirst = (_groups) => signInRefusal('sign-in', `Nothing was booked: booking needs the guest signed in to their ${deps.brand} account - ask them to sign in first.`, []);
|
|
722
|
+
/**
|
|
723
|
+
* The backend said this group needs the guest's membership linked before it books (0.74.0,
|
|
724
|
+
* robin 11-17): its 4012 after a new handshake, or its own words for a channel not linked
|
|
725
|
+
* (`unlinkedSaid`). ⚠️ NOTHING WAS ORDERED - both are answered before the group is asked
|
|
726
|
+
* (the document's `requireMemberAndMcpSession`) - so the guest links it, comes back and
|
|
727
|
+
* presses Book again: one order. The account marks the group to be linked again (its
|
|
728
|
+
* `expired` - the remembered link stays, 总线程 11-17).
|
|
729
|
+
*/
|
|
730
|
+
const linkFirst = (acct, why) => {
|
|
731
|
+
sessions.delete(sessionKey(acct));
|
|
732
|
+
deps.auth?.expired?.(acct.key, acct.group);
|
|
733
|
+
const name = deps.groupOf(acct.group).name;
|
|
734
|
+
log(`[otaless] a booking at ${acct.group} needs its membership linked: ${why} - nothing was ordered`);
|
|
735
|
+
return signInRefusal('sign-in', `${name} needs the guest's ${name} membership linked to their ${deps.brand} account before this booking can be made, so nothing was booked or charged. Once it is linked, the guest presses Book again.`, [acct.group]);
|
|
736
|
+
};
|
|
693
737
|
/**
|
|
694
738
|
* One of this guest's orders, by its id or the code the guest quotes, with
|
|
695
739
|
* their sign-in at its group - never an order of anyone else, and never one
|
|
@@ -810,17 +854,19 @@ export const createOtalessBookings = (deps) => {
|
|
|
810
854
|
throw signedOut(acct);
|
|
811
855
|
if (!isCode(err, CHANNEL_SESSION_EXPIRED))
|
|
812
856
|
throw err;
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
throw signInRefusal('session-expired', `${name} says the guest's sign-in there is over, so nothing was done - ask them to sign in to ${name} through their ${deps.brand} account again.`, [acct.group]);
|
|
857
|
+
// ⚠️ 4012 AGAIN, AFTER A NEW HANDSHAKE (0.74.0): the backend has no session of the
|
|
858
|
+
// group's for this account - its membership is to be linked (again). Nothing ordered.
|
|
859
|
+
throw linkFirst(acct, '4012 again after a new handshake');
|
|
817
860
|
}
|
|
818
861
|
};
|
|
862
|
+
/**
|
|
863
|
+
* 401: the guest's sign-in to the ACCOUNT is over (0.74.0 - every booking goes with the
|
|
864
|
+
* account's own token, Sa-Token's `NotLoginException`). No link mends that: they sign in to
|
|
865
|
+
* the account again. The group's link is left as it is.
|
|
866
|
+
*/
|
|
819
867
|
const signedOut = (acct) => {
|
|
820
868
|
sessions.delete(sessionKey(acct));
|
|
821
|
-
deps.
|
|
822
|
-
const name = deps.groupOf(acct.group).name;
|
|
823
|
-
return signInRefusal('signed-out', `The guest's sign-in at ${name} is over, so nothing was done - ask them to sign in to ${name} through their ${deps.brand} account again.`, [acct.group]);
|
|
869
|
+
return signInRefusal('signed-out', `The guest's sign-in to their ${deps.brand} account is over, so nothing was done - ask them to sign in again.`, []);
|
|
824
870
|
};
|
|
825
871
|
// ── an order, as a booking ────────────────────────────────────────────────
|
|
826
872
|
/** One of the amounts the order asked: 13's, the quote's, or the quote's USD. */
|
|
@@ -1054,82 +1100,49 @@ export const createOtalessBookings = (deps) => {
|
|
|
1054
1100
|
? 'other nights'
|
|
1055
1101
|
: undefined;
|
|
1056
1102
|
/**
|
|
1057
|
-
* 8
|
|
1058
|
-
* `confirm_required`, #68)
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1063
|
-
* guest did it - nothing is booked, and the log says which it was.
|
|
1103
|
+
* 8 refused for a second step, with no order (`terms_required`, questions #66;
|
|
1104
|
+
* `confirm_required`, #68) - what the backend answered before its three steps (11-11).
|
|
1105
|
+
* ⚠️ NOT BOOKED, NOTHING SHOWN (0.74.0): what it sends to agree to or confirm, and its token
|
|
1106
|
+
* (the names guessed in #66 / #68), have no way back - the 11-17 document's steps 2 and 3
|
|
1107
|
+
* take a `confirmToken` of step 1 alone, and one of these sent there would be read as that.
|
|
1108
|
+
* Never agreed or confirmed for the guest (#52); the log says which it was.
|
|
1064
1109
|
*/
|
|
1065
|
-
const groupAsked = (a, step, data
|
|
1110
|
+
const groupAsked = (a, step, data) => {
|
|
1066
1111
|
const g = deps.groupOf(a.group);
|
|
1067
1112
|
const what = `${step}_required`;
|
|
1068
1113
|
const code = (step === 'terms' ? 'group-terms' : 'group-confirm');
|
|
1069
1114
|
const asked = groupStepOf(step, data);
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
const amountOff = off === 'another amount';
|
|
1073
|
-
if (off) {
|
|
1074
|
-
log(`[otaless] booking at ${a.group} answered ${what} for ${amountOff ? 'another amount' : 'other nights'} than the guest was shown - not shown, not booked`);
|
|
1075
|
-
return {
|
|
1076
|
-
failed: failedStay(a, `${g.name} asked for ${step === 'terms' ? 'its terms to be agreed to' : 'the booking to be confirmed'} at ${amountOff ? 'another amount' : 'other nights'} than the guest was shown, so nothing was booked or charged.`, code),
|
|
1077
|
-
};
|
|
1078
|
-
}
|
|
1079
|
-
log(`[otaless] booking at ${a.group} answered ${what} with what to ${step === 'terms' ? 'agree to' : 'confirm'} - shown to the guest, nothing ordered`);
|
|
1080
|
-
return {
|
|
1081
|
-
terms: remember({
|
|
1082
|
-
ref: randomBytes(18).toString('base64url'),
|
|
1083
|
-
group: a.group,
|
|
1084
|
-
...groupWords(a.group),
|
|
1085
|
-
hotelId: a.hotel.id,
|
|
1086
|
-
hotelName: a.hotel.name,
|
|
1087
|
-
...(a.hotel.names?.name ? { hotelNames: a.hotel.names.name } : {}),
|
|
1088
|
-
roomName: a.roomName,
|
|
1089
|
-
stay: a.stay,
|
|
1090
|
-
rooms: a.rooms,
|
|
1091
|
-
total: a.total,
|
|
1092
|
-
text: asked.text,
|
|
1093
|
-
source: 'booking',
|
|
1094
|
-
more: true,
|
|
1095
|
-
askedByGroup: step,
|
|
1096
|
-
until: iso(now() + TERMS_MS),
|
|
1097
|
-
owner: a.acct.owner,
|
|
1098
|
-
key: a.acct.key,
|
|
1099
|
-
ask: {
|
|
1100
|
-
roomId: a.roomId,
|
|
1101
|
-
guest: a.guest,
|
|
1102
|
-
roomTerms: a.agreed,
|
|
1103
|
-
token: asked.token,
|
|
1104
|
-
step,
|
|
1105
|
-
},
|
|
1106
|
-
}),
|
|
1107
|
-
};
|
|
1108
|
-
}
|
|
1109
|
-
// After the guest agreed to the group's own terms - 8's (0.72.1) or a step's.
|
|
1110
|
-
const agreedAlready = !!a.groupStep || a.groupTerms === 'agreed';
|
|
1115
|
+
// After the guest agreed to the group's own terms (8's steps).
|
|
1116
|
+
const agreedAlready = a.groupTerms === 'agreed';
|
|
1111
1117
|
log(agreedAlready
|
|
1112
1118
|
? `[otaless] booking at ${a.group} answered ${what} again, after the guest ${step === 'terms' ? 'agreed to its terms' : 'confirmed it'} - not booked`
|
|
1113
|
-
:
|
|
1119
|
+
: asked
|
|
1120
|
+
? `[otaless] booking at ${a.group} answered ${what} with what to ${step === 'terms' ? 'agree to' : 'confirm'} and a token of its own, which 8 has no way to take back (its steps take step 1's confirmToken alone) - not shown, not booked (questions #${step === 'terms' ? 66 : 68})`
|
|
1121
|
+
: `[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})`);
|
|
1114
1122
|
const again = step === 'terms'
|
|
1115
1123
|
? `${g.name} asked for its terms to be agreed to again after the guest agreed to them, so nothing was booked or charged.`
|
|
1116
1124
|
: `${g.name} asked for the booking to be confirmed again after the guest confirmed it, so nothing was booked or charged.`;
|
|
1117
|
-
const none =
|
|
1118
|
-
?
|
|
1119
|
-
|
|
1125
|
+
const none = asked
|
|
1126
|
+
? step === 'terms'
|
|
1127
|
+
? `${g.name} asked for terms of its own to be agreed to in a way that cannot be answered from here, so nothing was booked or charged.`
|
|
1128
|
+
: `${g.name} asked for the booking to be confirmed in a way that cannot be answered from here, so nothing was booked or charged.`
|
|
1129
|
+
: step === 'terms'
|
|
1130
|
+
? `${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.`
|
|
1131
|
+
: `${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.`;
|
|
1120
1132
|
// New codes for the card (酒店平台's next version): until then, these words.
|
|
1121
1133
|
return { failed: failedStay(a, agreedAlready ? again : none, code) };
|
|
1122
1134
|
};
|
|
1123
1135
|
/**
|
|
1124
|
-
* 8 answered the group's own terms, and no order (`WireBookingTerms` - the 11-
|
|
1125
|
-
*
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1129
|
-
*
|
|
1130
|
-
* ⚠️
|
|
1131
|
-
*
|
|
1132
|
-
*
|
|
1136
|
+
* 8's step 1 answered the group's own terms, and no order (`WireBookingTerms` - the 11-17
|
|
1137
|
+
* document: a group whose `/site` says it asks for them; robin 11-16, questions #66, #79).
|
|
1138
|
+
* ⚠️ NEVER AGREED FOR THE GUEST (#52): its `termsPoints` and `cancellation`, word for word,
|
|
1139
|
+
* are the guest's to read and agree to themselves - the card's button or the one-time page;
|
|
1140
|
+
* agreed, the room is priced again and steps 2 and 3 sent with its `confirmToken`, which
|
|
1141
|
+
* order it (`place`). Not agreed: nothing more is sent.
|
|
1142
|
+
* ⚠️ THE TOKEN IS KEPT WITH THE TERMS, IN MEMORY ALONE (`Pending`); with none, they cannot
|
|
1143
|
+
* be agreed to - not shown, not booked. ⚠️ NOT HANDED ON: `next` (words for a model - "ask
|
|
1144
|
+
* about add-ons before the yes"), the `summary` (to the log alone, questions #75),
|
|
1145
|
+
* `acceptArgs` (the backend keeps its own). For another hotel or room than the one asked,
|
|
1133
1146
|
* with nothing to show, too long to show whole, or answered again after the guest agreed:
|
|
1134
1147
|
* nothing is shown and nothing booked.
|
|
1135
1148
|
*/
|
|
@@ -1169,11 +1182,12 @@ export const createOtalessBookings = (deps) => {
|
|
|
1169
1182
|
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');
|
|
1170
1183
|
if (shown.length > TERMS_MAX)
|
|
1171
1184
|
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.`);
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1185
|
+
// ⚠️ THE TOKEN STEPS 2 AND 3 GO WITH (the 11-17 document): with none - or one that is not
|
|
1186
|
+
// a token - the terms cannot be agreed to, so they are not shown.
|
|
1187
|
+
const token = typeof w.confirmToken === 'string' ? w.confirmToken.trim() : '';
|
|
1188
|
+
if (!STEP_TOKEN.test(token))
|
|
1189
|
+
return notBooked('with no confirmToken to agree to them with (steps 2 and 3 take one - the 11-17 document)', `${g.name} sent its own terms with no way to agree to them from here, so nothing was booked or charged.`, 'group-terms');
|
|
1190
|
+
log(`[otaless] booking at ${a.group} answered its terms (${[points.length ? `termsPoints${points.length > 1 || Array.isArray(w.termsPoints) ? ` - ${points.length} points` : ''}` : '', text(w.cancellation ?? undefined) ? 'cancellation' : ''].filter(Boolean).join(', ')}) - shown to the guest, nothing ordered; its confirmToken ${tokenForLog(token)} kept in memory for the guest's yes${w.acceptArgs !== undefined && w.acceptArgs !== null ? '; acceptArgs not sent back (the backend keeps its own)' : ''}${a.groupTerms ? '' : ` - 8 was sent with no termsRequired: /site said ${a.group} asks for none (out of date - read again within ten minutes)`}`);
|
|
1177
1191
|
return {
|
|
1178
1192
|
terms: remember({
|
|
1179
1193
|
ref: randomBytes(18).toString('base64url'),
|
|
@@ -1200,6 +1214,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1200
1214
|
guest: a.guest,
|
|
1201
1215
|
groupTerms: 'answered',
|
|
1202
1216
|
parts: points.length > 1 ? [...parts, ...points] : parts,
|
|
1217
|
+
confirmToken: token,
|
|
1203
1218
|
},
|
|
1204
1219
|
}),
|
|
1205
1220
|
};
|
|
@@ -1502,18 +1517,23 @@ export const createOtalessBookings = (deps) => {
|
|
|
1502
1517
|
const k = termsKey(said);
|
|
1503
1518
|
if (k === termsKey(a.agreed))
|
|
1504
1519
|
return true;
|
|
1505
|
-
if (a.groupStep?.step === 'terms' && k === termsKey(a.groupStep.text))
|
|
1506
|
-
return true;
|
|
1507
1520
|
return a.groupTerms === 'agreed' && (a.agreedParts ?? []).some((p) => termsKey(p) === k);
|
|
1508
1521
|
};
|
|
1509
1522
|
/** What 8 answered, settled: an order to hand on, one held for new terms, or none. */
|
|
1510
1523
|
const settle = async (a, w, pairs) => {
|
|
1511
|
-
// ⚠️ THE GROUP'S TERMS, NOT AN ORDER (0.72.1): 8
|
|
1512
|
-
//
|
|
1513
|
-
// ⚠️
|
|
1514
|
-
//
|
|
1515
|
-
//
|
|
1516
|
-
|
|
1524
|
+
// ⚠️ THE GROUP'S TERMS, NOT AN ORDER (0.72.1): 8's step 1 answers them with no order id -
|
|
1525
|
+
// never an order "being looked into" (核对中) below.
|
|
1526
|
+
// ⚠️ AN 8 SENT WITH `termsRequired` - OR ONE ANSWERED WITH STEP 1'S TOKEN (0.74.0, 总线程
|
|
1527
|
+
// 11-17): the backend goes by its own `/site` (the 11-17 document), so a group whose
|
|
1528
|
+
// `/site` we read as asking for none ten minutes ago may answer step 1 all the same - its
|
|
1529
|
+
// terms and a `confirmToken`, nothing ordered; kept as one being looked into, that stay was
|
|
1530
|
+
// held back for hours with no order anywhere. Its terms are shown and agreed to as any.
|
|
1531
|
+
// ⚠️ NEVER ON ITS OWN MARKS ALONE (总线程's review of 0.72.1, P3-1): at a group that asks
|
|
1532
|
+
// for no terms (Atour, JI - `/site` false) an answer with no id and no such token is an
|
|
1533
|
+
// order's, being looked into - never "not booked", booked again.
|
|
1534
|
+
if ((a.groupTerms ||
|
|
1535
|
+
STEP_TOKEN.test(String(w?.confirmToken ?? '').trim())) &&
|
|
1536
|
+
isBookingTerms(w))
|
|
1517
1537
|
return termsFrom8(a, w);
|
|
1518
1538
|
return settleOrder(a, w, pairs);
|
|
1519
1539
|
};
|
|
@@ -1547,7 +1567,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1547
1567
|
// Terms of its own to agree to, and no order (questions #66).
|
|
1548
1568
|
const step = /TERMS/.test(status) ? 'terms' : stepAsked(status);
|
|
1549
1569
|
if (step)
|
|
1550
|
-
return groupAsked(a, step, w
|
|
1570
|
+
return groupAsked(a, step, w);
|
|
1551
1571
|
// Something may be held, under a number we were not told: kept to look for (12).
|
|
1552
1572
|
const r = recordOf(a, pairs, `pending:${randomBytes(8).toString('hex')}`, '', 'unconfirmed');
|
|
1553
1573
|
put(r);
|
|
@@ -1709,6 +1729,22 @@ export const createOtalessBookings = (deps) => {
|
|
|
1709
1729
|
* only `PRICED_IN_MS`, by the sign-in's token - in memory alone.
|
|
1710
1730
|
*/
|
|
1711
1731
|
const pricedIn = new Map();
|
|
1732
|
+
/**
|
|
1733
|
+
* 8's step-3 tokens whose order is not known (核对中 - 0.74.0), by that order's id: kept as
|
|
1734
|
+
* 总线程 11-17 asked, for the day the backend can look an order up by one (questions #88).
|
|
1735
|
+
* ⚠️ IN MEMORY ONLY, NEVER SENT AGAIN, never on disk, the card, to the model or on the log
|
|
1736
|
+
* whole; gone with a restart, or past `PENDING_MAX`.
|
|
1737
|
+
*/
|
|
1738
|
+
const checkoutTokens = new Map();
|
|
1739
|
+
const keepCheckoutToken = (id, token) => {
|
|
1740
|
+
checkoutTokens.set(id, token);
|
|
1741
|
+
while (checkoutTokens.size > PENDING_MAX) {
|
|
1742
|
+
const first = checkoutTokens.keys().next().value;
|
|
1743
|
+
if (first === undefined)
|
|
1744
|
+
break;
|
|
1745
|
+
checkoutTokens.delete(first);
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1712
1748
|
const pricedKey = (a, token) => `${hash(token)}|${a.hotel.id}|${a.roomId}|${a.stay.checkIn}|${a.stay.checkOut}|${a.stay.guests}|${a.rooms}`;
|
|
1713
1749
|
const pricedJustNow = (a, token, data) => {
|
|
1714
1750
|
const k = pricedKey(a, token);
|
|
@@ -1742,11 +1778,27 @@ export const createOtalessBookings = (deps) => {
|
|
|
1742
1778
|
* session, held to the price they were shown - and only then 8, in that same
|
|
1743
1779
|
* session (总线程 11-11, C). A 4012 on either is one new handshake and one more
|
|
1744
1780
|
* try of both.
|
|
1781
|
+
*
|
|
1782
|
+
* ⚠️ AT A GROUP THAT ASKS FOR ITS OWN TERMS, ONCE THE GUEST AGREED TO THEM (0.74.0, the
|
|
1783
|
+
* 11-17 document - 总线程 11-17): 7, then 8's step 2 (`termsAccepted`), then its step 3
|
|
1784
|
+
* (`checkoutPayment`), all here, with step 1's token alone. A price that moved stops it
|
|
1785
|
+
* before step 2. Step 2 not answered, refused as a repeat (10014) or for its state is no
|
|
1786
|
+
* failure: step 3 follows all the same - the backend orders it only once step 2 took, so
|
|
1787
|
+
* one that did not is refused there and nothing is ordered. ONLY STEP 3 MAY ORDER
|
|
1788
|
+
* (`fromBook`): not answered, or 10014, it is an order not known (核对中) and never sent
|
|
1789
|
+
* again; a 4012 is answered before the group is asked - a new handshake, and all once more.
|
|
1745
1790
|
*/
|
|
1746
1791
|
const place = async (a) => {
|
|
1747
1792
|
const g = deps.groupOf(a.group);
|
|
1793
|
+
// The guest's yes to the group's own terms, with no token to send it with: nothing to send.
|
|
1794
|
+
if (a.groupTerms === 'agreed' && !a.confirmToken) {
|
|
1795
|
+
log(`[otaless] booking at ${a.group}: the guest agreed to its terms with no confirmToken kept - not booked`);
|
|
1796
|
+
return {
|
|
1797
|
+
failed: failedStay(a, `${g.name}'s terms can no longer be agreed to from here, so nothing was booked or charged - ask to book again.`, 'group-terms'),
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1748
1800
|
let pairs;
|
|
1749
|
-
/** What 8 itself threw, if it did: only that may have made an order. */
|
|
1801
|
+
/** What 8 itself threw, if it did - its step 3, at a group with three: only that may have made an order. */
|
|
1750
1802
|
let fromBook;
|
|
1751
1803
|
/** A refusal for a step naming an order we keep already (`knownNamed`) - see `madeIn`. */
|
|
1752
1804
|
let namedKnown;
|
|
@@ -1756,7 +1808,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1756
1808
|
fromBook = undefined;
|
|
1757
1809
|
let priced;
|
|
1758
1810
|
const ask = (mode) => deps.quoteIn(a.hotel, a.roomId, a.stay, a.rooms, cred, a.who, mode);
|
|
1759
|
-
const notPriced = (err) => isCode(err, NOT_SIGNED_IN) || isCode(err, CHANNEL_SESSION_EXPIRED)
|
|
1811
|
+
const notPriced = (err) => isCode(err, NOT_SIGNED_IN) || isCode(err, CHANNEL_SESSION_EXPIRED) || unlinkedSaid(err)
|
|
1760
1812
|
? err
|
|
1761
1813
|
: new NotPriced(err instanceof OtalessBusy, isCode(err, REPEAT_SUBMIT));
|
|
1762
1814
|
// ⚠️ THE 7 IN THE GUEST'S SESSION FIRST, AS EVER (总线程's review of 0.71.2, P2): it
|
|
@@ -1815,20 +1867,14 @@ export const createOtalessBookings = (deps) => {
|
|
|
1815
1867
|
checkIn: a.stay.checkIn,
|
|
1816
1868
|
checkOut: a.stay.checkOut,
|
|
1817
1869
|
roomCount: a.rooms,
|
|
1818
|
-
// 8's
|
|
1819
|
-
//
|
|
1820
|
-
...(a.groupTerms ? { termsRequired:
|
|
1821
|
-
// Only after the guest agreed to the terms 8 asked for (questions #66).
|
|
1822
|
-
...(a.groupStep?.step === 'terms'
|
|
1823
|
-
? { termsToken: a.groupStep.token, termsAccepted: true }
|
|
1824
|
-
: {}),
|
|
1825
|
-
...(a.groupStep?.step === 'confirm'
|
|
1826
|
-
? { confirmToken: a.groupStep.token, confirmed: true }
|
|
1827
|
-
: {}),
|
|
1870
|
+
// 8's step 1 (0.72.1): the group's terms asked for. Not sent at a group that asks
|
|
1871
|
+
// for no terms - nor after the guest agreed to them: steps 2 and 3 carry the token.
|
|
1872
|
+
...(a.groupTerms === 'ask' ? { termsRequired: true } : {}),
|
|
1828
1873
|
};
|
|
1874
|
+
const cred8 = { token: cred.token, ...(session ? { session } : {}) };
|
|
1829
1875
|
const send = async (b) => {
|
|
1830
1876
|
try {
|
|
1831
|
-
return await client.book(b,
|
|
1877
|
+
return await client.book(b, cred8, deps.callerOf(a.who));
|
|
1832
1878
|
}
|
|
1833
1879
|
catch (err) {
|
|
1834
1880
|
// ⚠️ A REFUSAL THAT CARRIES ITS ORDER IS THAT ORDER (总线程's review of
|
|
@@ -1872,11 +1918,45 @@ export const createOtalessBookings = (deps) => {
|
|
|
1872
1918
|
status: /TERMS/.test(status) || stepAsked(status) ? order.status : String(msg),
|
|
1873
1919
|
};
|
|
1874
1920
|
};
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1921
|
+
/**
|
|
1922
|
+
* 8's step 2 (the 11-17 document): the guest's own yes to the group's terms, with
|
|
1923
|
+
* step 1's token alone - orders nothing. ⚠️ NOT `send`: never `fromBook`. An answer
|
|
1924
|
+
* that is not its taking is said on the log and step 3 goes all the same (it orders
|
|
1925
|
+
* only once step 2 took - questions #89, #94); only the sign-in (401), the session
|
|
1926
|
+
* (4012 - `withSession`) or a limit of ours (not sent) stops it here. An order in its
|
|
1927
|
+
* answer - not in the document - is that order: step 3 is never sent after one.
|
|
1928
|
+
*/
|
|
1929
|
+
const agree = async (token) => {
|
|
1930
|
+
let said;
|
|
1931
|
+
try {
|
|
1932
|
+
said = await client.book({ confirmToken: token, termsAccepted: true }, cred8, deps.callerOf(a.who));
|
|
1933
|
+
}
|
|
1934
|
+
catch (err) {
|
|
1935
|
+
if (err instanceof OtalessBusy ||
|
|
1936
|
+
isCode(err, NOT_SIGNED_IN) ||
|
|
1937
|
+
isCode(err, CHANNEL_SESSION_EXPIRED))
|
|
1938
|
+
throw err;
|
|
1939
|
+
const how = unanswered(err)
|
|
1940
|
+
? 'not answered'
|
|
1941
|
+
: isCode(err, REPEAT_SUBMIT)
|
|
1942
|
+
? 'answered 10014'
|
|
1943
|
+
: `refused${err instanceof OtalessError && err.backendCode !== undefined ? ` (code ${err.backendCode})` : ''}`;
|
|
1944
|
+
log(`[otaless] booking at ${a.group}: step 2 (the guest's yes, ${tokenForLog(token)}) ${how} - step 3 sent all the same: it orders only once step 2 took (questions #89, #94)`);
|
|
1945
|
+
return undefined;
|
|
1946
|
+
}
|
|
1947
|
+
const d = (said.data ?? {});
|
|
1948
|
+
if (text(d.unifiedOrderId) || text(d.originalOrderId) || text(d.checkoutUrl)) {
|
|
1949
|
+
log(`[otaless] booking at ${a.group}: step 2 answered with an order (not in the document) - taken as that order, step 3 not sent`);
|
|
1950
|
+
return said;
|
|
1951
|
+
}
|
|
1952
|
+
log(`[otaless] booking at ${a.group}: step 2 took the guest's yes (${forTheLog(String(d.status ?? '?'))}) - step 3 next`);
|
|
1953
|
+
return undefined;
|
|
1954
|
+
};
|
|
1955
|
+
const confirmToken = a.groupTerms === 'agreed' ? a.confirmToken : undefined;
|
|
1956
|
+
const stepTwo = confirmToken ? await agree(confirmToken) : undefined;
|
|
1957
|
+
// ⚠️ STEP 3 ONCE, AND ONLY STEP 3 MAY ORDER (`send` - `fromBook`): never sent again for
|
|
1958
|
+
// this token here, whatever comes back. The first 8 of any other booking: the same.
|
|
1959
|
+
const booked = stepTwo ?? (await send(confirmToken ? { confirmToken, checkoutPayment: true } : body));
|
|
1880
1960
|
const back = booked.session ?? priced.session;
|
|
1881
1961
|
return { data: booked.data, ...(back ? { session: back } : {}) };
|
|
1882
1962
|
});
|
|
@@ -1897,6 +1977,11 @@ export const createOtalessBookings = (deps) => {
|
|
|
1897
1977
|
};
|
|
1898
1978
|
if (err instanceof OtalessBusy)
|
|
1899
1979
|
return { failed: limited(a, g.name) };
|
|
1980
|
+
// ⚠️ THE BACKEND'S OWN WORDS FOR A GROUP NOT LINKED (0.74.0, robin 11-17): refused, so
|
|
1981
|
+
// nothing was ordered - the guest links it and presses Book again. Any other refusal is
|
|
1982
|
+
// "not booked" below, with the backend's words on the log (client.ts).
|
|
1983
|
+
if (unlinkedSaid(err))
|
|
1984
|
+
throw linkFirst(a.acct, 'its own words for a group not linked');
|
|
1900
1985
|
// ⚠️ THE GROUP'S TERMS ASKED FOR, NOTHING AGREED - A 10014 IS NO ORDER (总线程's review
|
|
1901
1986
|
// of 0.72.1, P2-1): 8 sent with `termsRequired: true` answers the terms and orders
|
|
1902
1987
|
// nothing, so its repeat refused (10014) - Book pressed twice at Ascott, or asked again
|
|
@@ -1917,6 +2002,13 @@ export const createOtalessBookings = (deps) => {
|
|
|
1917
2002
|
if (err === fromBook && (unanswered(err) || isCode(err, REPEAT_SUBMIT))) {
|
|
1918
2003
|
const r = recordOf(a, pairs ?? { orig: a.total }, `pending:${randomBytes(8).toString('hex')}`, '', 'unconfirmed');
|
|
1919
2004
|
put(r);
|
|
2005
|
+
// ⚠️ 8's STEP 3 (0.74.0): its token stays - in memory alone, with the order not known -
|
|
2006
|
+
// and is never sent again; the order is looked for in the group's order list (12)
|
|
2007
|
+
// as any other (questions #88: whether the backend can look one up by its token).
|
|
2008
|
+
if (a.groupTerms === 'agreed' && a.confirmToken) {
|
|
2009
|
+
keepCheckoutToken(r.id, a.confirmToken);
|
|
2010
|
+
log(`[otaless] booking at ${a.group}: step 3 (checkout, ${tokenForLog(a.confirmToken)}) ${unanswered(err) ? 'not answered' : 'answered 10014'} - kept as not known (核对中), never sent again; looked for in its order list (12) (questions #88)`);
|
|
2011
|
+
}
|
|
1920
2012
|
return { booked: toBooking(r) };
|
|
1921
2013
|
}
|
|
1922
2014
|
if (namedKnown && err === namedKnown.err)
|
|
@@ -1924,7 +2016,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1924
2016
|
// ⚠️ 8 REFUSED FOR TERMS (robin 11-11 18:30, Ascott: code 500 "terms_required").
|
|
1925
2017
|
const step = err === fromBook && err instanceof OtalessError ? stepAsked(err.answer?.msg) : undefined;
|
|
1926
2018
|
if (step)
|
|
1927
|
-
return groupAsked(a, step, err instanceof OtalessError ? err.answer?.data : undefined
|
|
2019
|
+
return groupAsked(a, step, err instanceof OtalessError ? err.answer?.data : undefined);
|
|
1928
2020
|
const ref = err === fromBook && err instanceof OtalessError
|
|
1929
2021
|
? refusalOf(a, err.answer?.data, err.answer?.msg)
|
|
1930
2022
|
: undefined;
|
|
@@ -2162,7 +2254,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
2162
2254
|
const group = hotel.supplier;
|
|
2163
2255
|
const acct = accountFor(who, group);
|
|
2164
2256
|
if (!acct) {
|
|
2165
|
-
failed.push(
|
|
2257
|
+
failed.push(failedStay(label, signInFirst([group]).message));
|
|
2166
2258
|
continue;
|
|
2167
2259
|
}
|
|
2168
2260
|
const lockKey = `${acct.owner}|${hotel.id}|${line.roomRef}|${stay.checkIn}|${stay.checkOut}|${rooms}`;
|
|
@@ -2326,15 +2418,16 @@ export const createOtalessBookings = (deps) => {
|
|
|
2326
2418
|
roomName: p.roomName,
|
|
2327
2419
|
stay: p.stay,
|
|
2328
2420
|
rooms: p.rooms,
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
: {}),
|
|
2334
|
-
// 8's own two steps (0.72.1): the group's terms as 8 answered them, agreed - the
|
|
2335
|
-
// order now; or the room's, at a group whose `/site` did not say - 8 asks for them.
|
|
2421
|
+
agreed: p.text,
|
|
2422
|
+
// 8's own steps: the group's terms as its step 1 answered them, agreed - steps 2 and
|
|
2423
|
+
// 3 with its token, the order now (0.74.0); or the room's, at a group whose `/site`
|
|
2424
|
+
// did not say - 8 asks for them (0.72.1).
|
|
2336
2425
|
...(ask.groupTerms === 'answered'
|
|
2337
|
-
? {
|
|
2426
|
+
? {
|
|
2427
|
+
groupTerms: 'agreed',
|
|
2428
|
+
...(ask.parts ? { agreedParts: ask.parts } : {}),
|
|
2429
|
+
...(ask.confirmToken ? { confirmToken: ask.confirmToken } : {}),
|
|
2430
|
+
}
|
|
2338
2431
|
: ask.groupTerms === 'ask'
|
|
2339
2432
|
? { groupTerms: 'ask' }
|
|
2340
2433
|
: {}),
|