@curless/hotel-storefront 0.63.1 → 0.63.2
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/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 +53 -6
- package/dist/otaless/booking.d.ts.map +1 -1
- package/dist/otaless/booking.js +188 -44
- package/dist/otaless/booking.js.map +1 -1
- package/dist/otaless/fake.d.ts.map +1 -1
- package/dist/otaless/fake.js +4 -2
- 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 +12 -7
- package/dist/server.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +51 -8
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +24 -0
- package/dist/types.d.ts.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,k4u3CAAk4u3C,EACl4u3C,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"}
|
|
@@ -9,14 +9,30 @@ export declare const TERMS_MS: number;
|
|
|
9
9
|
export declare const SESSION_IDLE_MS: number;
|
|
10
10
|
/** A payment's status is asked for at most this often per order (§12.1, 15). */
|
|
11
11
|
export declare const STATUS_EVERY_MS = 10000;
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* An order 13 did not answer for, not found in the group's list this long
|
|
14
|
+
* after it was asked for - and nothing there that could be it - no longer holds
|
|
15
|
+
* the stay back (总线程's re-review of 0.63.1, 1). Eight times the 15 minutes
|
|
16
|
+
* the document's checkout holds a room unpaid.
|
|
17
|
+
*/
|
|
18
|
+
export declare const UNCONFIRMED_GIVE_UP_MS: number;
|
|
19
|
+
/**
|
|
20
|
+
* An order waiting for its payment with no time to pay by from 13: taken as
|
|
21
|
+
* payable this long after it was made, or after the payment status (15) last
|
|
22
|
+
* said it is still waiting (总线程's re-review of 0.63.1, 2).
|
|
23
|
+
*/
|
|
24
|
+
export declare const ASSUMED_HOLD_MS: number;
|
|
25
|
+
/** What the payment status (15) says of a payment that can no longer be made. */
|
|
26
|
+
export declare const CLOSED_PAYMENT_STATUSES: ReadonlySet<string>;
|
|
14
27
|
/** The longest terms shown word for word - longer is refused rather than cut. */
|
|
15
28
|
export declare const TERMS_MAX = 50000;
|
|
16
29
|
/**
|
|
17
|
-
* The payment pages a guest may be sent to, until a deployment says otherwise
|
|
18
|
-
*
|
|
19
|
-
* no wildcard, no other port.
|
|
30
|
+
* The payment pages a guest may be sent to, until a deployment says otherwise:
|
|
31
|
+
* the group checkout host of 13's own example (`pay.discoverasr.com`). Exact
|
|
32
|
+
* host names: no wildcard, no other port. ⚠️ NOT `mcp.curless.ai` (总线程's
|
|
33
|
+
* re-review of 0.63.1, 720f5e4f): that is our own hosted checkout, which takes
|
|
34
|
+
* any merchant and any amount - and it only ever appeared in the example of 8,
|
|
35
|
+
* which is never called here.
|
|
20
36
|
*/
|
|
21
37
|
export declare const DEFAULT_CHECKOUT_HOSTS: readonly string[];
|
|
22
38
|
/**
|
|
@@ -102,6 +118,27 @@ export type OrderRecord = {
|
|
|
102
118
|
released?: 'price' | 'amount' | 'address';
|
|
103
119
|
/** Letting it go did not go through: a person must see to it. */
|
|
104
120
|
releaseFailed?: true;
|
|
121
|
+
/**
|
|
122
|
+
* What was paid, as the group reported it - the payment status (15) or a
|
|
123
|
+
* PAID order row (12) - when that is one of the amounts asked. What a refund
|
|
124
|
+
* previews (总线程's re-review of 0.63.1, 3).
|
|
125
|
+
*/
|
|
126
|
+
paidAmount?: Money;
|
|
127
|
+
/** When the payment status (15) last said it is still waiting to be paid, ISO. */
|
|
128
|
+
pendingSeenAt?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Said paid at an amount that is none of the ones asked - or with none: not
|
|
131
|
+
* taken as paid, no payment link handed on; a person looks (shown as
|
|
132
|
+
* `unconfirmed`).
|
|
133
|
+
*/
|
|
134
|
+
needsPerson?: 'paid-amount';
|
|
135
|
+
/**
|
|
136
|
+
* 13 did not answer, and the order could not be found in the group's list
|
|
137
|
+
* for `UNCONFIRMED_GIVE_UP_MS` - nor anything there that could be it: no
|
|
138
|
+
* longer holds the stay back (总线程's re-review of 0.63.1, 1). Still shown
|
|
139
|
+
* as not known.
|
|
140
|
+
*/
|
|
141
|
+
unverifiable?: true;
|
|
105
142
|
};
|
|
106
143
|
/** Terms a group sent back, for the guest to agree to - or not (§12.4). */
|
|
107
144
|
export type TermsToAgree = {
|
|
@@ -193,8 +230,18 @@ export type RefundPreview = {
|
|
|
193
230
|
bookingId: string;
|
|
194
231
|
confirmationCode: string;
|
|
195
232
|
supplier: string;
|
|
196
|
-
/**
|
|
233
|
+
/**
|
|
234
|
+
* All of what was paid - a part is never asked for: as the group reported it
|
|
235
|
+
* paid (`fromPayment`), else what the order asked (总线程's re-review of
|
|
236
|
+
* 0.63.1, 3).
|
|
237
|
+
*/
|
|
197
238
|
amount: Money;
|
|
239
|
+
fromPayment: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* ⚠️ 9.1 TAKES NO AMOUNT: the request asks for all of it back and names no
|
|
242
|
+
* figure, so how much comes back is the group's to say - say so.
|
|
243
|
+
*/
|
|
244
|
+
groupDecides: true;
|
|
198
245
|
/** The group's terms for this booking, word for word - '' when it sent none. */
|
|
199
246
|
terms: string;
|
|
200
247
|
/** Until when `preview` can be sent, ISO. */
|
|
@@ -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,EAML,KAAK,aAAa,EAQlB,KAAK,SAAS,EAEf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA6B1C,yFAAyF;AACzF,eAAO,MAAM,QAAQ,QAAc,CAAC;AACpC,kEAAkE;AAClE,eAAO,MAAM,eAAe,QAAkB,CAAC;AAC/C,gFAAgF;AAChF,eAAO,MAAM,eAAe,QAAS,CAAC;AACtC,
|
|
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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ACJ,MAAM,KACd,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;;CAyP3B,CAAC"}
|
package/dist/otaless/booking.js
CHANGED
|
@@ -37,8 +37,37 @@ export const TERMS_MS = 10 * 60_000;
|
|
|
37
37
|
export const SESSION_IDLE_MS = 2 * 60 * 60_000;
|
|
38
38
|
/** A payment's status is asked for at most this often per order (§12.1, 15). */
|
|
39
39
|
export const STATUS_EVERY_MS = 10_000;
|
|
40
|
-
/**
|
|
41
|
-
|
|
40
|
+
/**
|
|
41
|
+
* An order 13 did not answer for, not found in the group's list this long
|
|
42
|
+
* after it was asked for - and nothing there that could be it - no longer holds
|
|
43
|
+
* the stay back (总线程's re-review of 0.63.1, 1). Eight times the 15 minutes
|
|
44
|
+
* the document's checkout holds a room unpaid.
|
|
45
|
+
*/
|
|
46
|
+
export const UNCONFIRMED_GIVE_UP_MS = 2 * 60 * 60_000;
|
|
47
|
+
/**
|
|
48
|
+
* An order waiting for its payment with no time to pay by from 13: taken as
|
|
49
|
+
* payable this long after it was made, or after the payment status (15) last
|
|
50
|
+
* said it is still waiting (总线程's re-review of 0.63.1, 2).
|
|
51
|
+
*/
|
|
52
|
+
export const ASSUMED_HOLD_MS = 30 * 60_000;
|
|
53
|
+
/** What the payment status (15) says of a payment that can no longer be made. */
|
|
54
|
+
export const CLOSED_PAYMENT_STATUSES = new Set([
|
|
55
|
+
'EXPIRED',
|
|
56
|
+
'CLOSED',
|
|
57
|
+
'CANCELLED',
|
|
58
|
+
'CANCELED',
|
|
59
|
+
'FAILED',
|
|
60
|
+
'TIMEOUT',
|
|
61
|
+
]);
|
|
62
|
+
/** What an order row (12) says of an order that holds nothing now. */
|
|
63
|
+
const DEAD_ROW_STATUSES = new Set([
|
|
64
|
+
'CANCELLED',
|
|
65
|
+
'CANCELED',
|
|
66
|
+
'FAILED',
|
|
67
|
+
'REFUNDED',
|
|
68
|
+
'EXPIRED',
|
|
69
|
+
'CLOSED',
|
|
70
|
+
]);
|
|
42
71
|
/** The longest terms shown word for word - longer is refused rather than cut. */
|
|
43
72
|
export const TERMS_MAX = 50_000;
|
|
44
73
|
/** A guest's reason for cancelling, as the group's staff are sent it. */
|
|
@@ -49,11 +78,14 @@ const PENDING_PER_ACCOUNT = 5;
|
|
|
49
78
|
/** The orders checked on one look at the bookings - newest first; the rest wait for the next look. */
|
|
50
79
|
const CHECKED_PER_LOOK = 5;
|
|
51
80
|
/**
|
|
52
|
-
* The payment pages a guest may be sent to, until a deployment says otherwise
|
|
53
|
-
*
|
|
54
|
-
* no wildcard, no other port.
|
|
81
|
+
* The payment pages a guest may be sent to, until a deployment says otherwise:
|
|
82
|
+
* the group checkout host of 13's own example (`pay.discoverasr.com`). Exact
|
|
83
|
+
* host names: no wildcard, no other port. ⚠️ NOT `mcp.curless.ai` (总线程's
|
|
84
|
+
* re-review of 0.63.1, 720f5e4f): that is our own hosted checkout, which takes
|
|
85
|
+
* any merchant and any amount - and it only ever appeared in the example of 8,
|
|
86
|
+
* which is never called here.
|
|
55
87
|
*/
|
|
56
|
-
export const DEFAULT_CHECKOUT_HOSTS = ['
|
|
88
|
+
export const DEFAULT_CHECKOUT_HOSTS = ['pay.discoverasr.com'];
|
|
57
89
|
/** How long a refund's preview can be sent back (总线程's review of 0.63.0, B). */
|
|
58
90
|
export const REFUND_PREVIEW_MS = 10 * 60_000;
|
|
59
91
|
const refusal = (code, message) => Object.assign(new Error(message), { code });
|
|
@@ -378,8 +410,21 @@ export const createOtalessBookings = (deps) => {
|
|
|
378
410
|
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]);
|
|
379
411
|
};
|
|
380
412
|
// ── an order, as a booking ────────────────────────────────────────────────
|
|
413
|
+
/** One of the amounts the order asked: 13's, the quote's, or the quote's USD. */
|
|
414
|
+
const asked = (m, r) => same(m, r.charged) || same(m, r.quoted) || same(m, r.quotedUsd);
|
|
415
|
+
/** What was paid - as the group reported it, else what the order asked (总线程's re-review of 0.63.1, 3). */
|
|
416
|
+
const paidOf = (r) => r.paidAmount ?? r.charged ?? r.quoted;
|
|
417
|
+
/**
|
|
418
|
+
* Until when an order waiting for its payment may still be paid: 13's time,
|
|
419
|
+
* else `ASSUMED_HOLD_MS` after it was made or last said waiting (总线程's
|
|
420
|
+
* re-review of 0.63.1, 2).
|
|
421
|
+
*/
|
|
422
|
+
const payableUntil = (r) => r.payBy ? Date.parse(r.payBy) : Date.parse(r.pendingSeenAt ?? r.createdAt) + ASSUMED_HOLD_MS;
|
|
381
423
|
const paymentOf = (r) => {
|
|
382
|
-
const amount = r
|
|
424
|
+
const amount = paidOf(r);
|
|
425
|
+
// Said paid at another amount: nothing about its money is said but by a person.
|
|
426
|
+
if (r.needsPerson)
|
|
427
|
+
return undefined;
|
|
383
428
|
if (r.refund)
|
|
384
429
|
return {
|
|
385
430
|
method: 'card',
|
|
@@ -392,7 +437,8 @@ export const createOtalessBookings = (deps) => {
|
|
|
392
437
|
if (r.paid)
|
|
393
438
|
return { method: 'card', amount, status: 'paid' };
|
|
394
439
|
if (r.status === 'awaiting-payment') {
|
|
395
|
-
|
|
440
|
+
// ⚠️ NO LINK PAST ITS TIME: a page that cannot be paid any more is not handed on.
|
|
441
|
+
const url = now() < payableUntil(r) ? payLinks.get(r.id) : undefined;
|
|
396
442
|
return {
|
|
397
443
|
method: 'card',
|
|
398
444
|
amount,
|
|
@@ -423,11 +469,12 @@ export const createOtalessBookings = (deps) => {
|
|
|
423
469
|
day: r.stay.checkIn,
|
|
424
470
|
};
|
|
425
471
|
const payment = paymentOf(r);
|
|
426
|
-
|
|
472
|
+
const booking = {
|
|
427
473
|
id: r.id,
|
|
428
474
|
supplier: r.group,
|
|
429
475
|
confirmationCode: r.code || r.id,
|
|
430
|
-
|
|
476
|
+
// A person is looking at its payment: not known, as the type says it.
|
|
477
|
+
status: r.needsPerson ? 'unconfirmed' : r.status,
|
|
431
478
|
createdAt: r.createdAt,
|
|
432
479
|
hotelId: r.hotelId,
|
|
433
480
|
hotelName: r.hotelName,
|
|
@@ -445,6 +492,8 @@ export const createOtalessBookings = (deps) => {
|
|
|
445
492
|
},
|
|
446
493
|
...(r.cancelledAt ? { cancelledAt: r.cancelledAt } : {}),
|
|
447
494
|
};
|
|
495
|
+
// Beside the type, for the words (0.63.2): why it is not known.
|
|
496
|
+
return Object.assign(booking, r.unverifiable ? { unverifiable: true } : {}, r.needsPerson ? { needsPerson: r.needsPerson } : {});
|
|
448
497
|
};
|
|
449
498
|
const failedStay = (a, why, code) => ({
|
|
450
499
|
hotelId: a.hotel.id,
|
|
@@ -669,6 +718,25 @@ export const createOtalessBookings = (deps) => {
|
|
|
669
718
|
}
|
|
670
719
|
return settle(a, w);
|
|
671
720
|
};
|
|
721
|
+
/**
|
|
722
|
+
* An order row that could be an order 13 did not answer for: of the group,
|
|
723
|
+
* for those nights, not one of ours, and holding something (not cancelled,
|
|
724
|
+
* failed, refunded or closed).
|
|
725
|
+
*/
|
|
726
|
+
const couldBe = (row, group, stay) => {
|
|
727
|
+
const id = text(row.unifiedOrderId);
|
|
728
|
+
if (id && orders.has(id))
|
|
729
|
+
return false;
|
|
730
|
+
const code = text(row.providerCode)?.toLowerCase();
|
|
731
|
+
if (code && code !== group)
|
|
732
|
+
return false;
|
|
733
|
+
const dates = String(row.dates ?? '');
|
|
734
|
+
if (!dates.includes(stay.checkIn) || !dates.includes(stay.checkOut))
|
|
735
|
+
return false;
|
|
736
|
+
return !DEAD_ROW_STATUSES.has(String(row.status ?? '')
|
|
737
|
+
.trim()
|
|
738
|
+
.toUpperCase());
|
|
739
|
+
};
|
|
672
740
|
const requestBooking = async (trip, guest, who) => {
|
|
673
741
|
// ⚠️ SIGNED IN AT EVERY GROUP OF THE TRIP, OR NOTHING IS SENT (robin 11-10:
|
|
674
742
|
// one sign-in per group, the backend's own) - the whole trip is refused
|
|
@@ -752,20 +820,55 @@ export const createOtalessBookings = (deps) => {
|
|
|
752
820
|
// ⚠️ AN EARLIER ORDER OF THIS STAY THAT MAY HAVE BEEN MADE IS LOOKED FOR
|
|
753
821
|
// FIRST, HOWEVER OLD (总线程's review of 0.63.0, 5): the group's order list
|
|
754
822
|
// (12) is read; not found there - or not readable - nothing new is sent.
|
|
755
|
-
const
|
|
823
|
+
const name = deps.groupOf(group).name;
|
|
824
|
+
// Said paid at another amount: a person's - nothing new beside it.
|
|
825
|
+
if ([...orders.values()].some((o) => sameStay(o) && o.needsPerson)) {
|
|
826
|
+
failed.push(failedStay(label, `An earlier booking of this stay needs a person to check its payment with ${name}, so nothing new was booked.`,
|
|
827
|
+
// For the card to say in the guest's language (酒店平台 0.63.2, `NoRoomsCode`).
|
|
828
|
+
'earlier-needs-person'));
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
const unknown = [...orders.values()].filter((o) => sameStay(o) && o.status === 'unconfirmed' && !o.unverifiable);
|
|
756
832
|
if (unknown.length) {
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
|
|
833
|
+
const rows = await lookAtOrders(acct, who, group, unknown);
|
|
834
|
+
const still = unknown.filter((o) => o.status === 'unconfirmed');
|
|
835
|
+
// ⚠️ THE WAY OUT (总线程's re-review of 0.63.1, 1): long enough after it
|
|
836
|
+
// was asked for - past any hold on an unpaid room - and with nothing in
|
|
837
|
+
// the group's list that could be it, the stay is no longer held back.
|
|
838
|
+
// The guest is told first, as it is; asked again, a new booking is made.
|
|
839
|
+
// (Not by the payment status, 15: an order 13 never named has no id to
|
|
840
|
+
// ask it by - its list, 12, is all there is.)
|
|
841
|
+
if (rows &&
|
|
842
|
+
still.length &&
|
|
843
|
+
still.every((o) => now() - Date.parse(o.createdAt) >= UNCONFIRMED_GIVE_UP_MS) &&
|
|
844
|
+
!rows.some((row) => couldBe(row, group, stay))) {
|
|
845
|
+
for (const o of still) {
|
|
846
|
+
o.unverifiable = true;
|
|
847
|
+
put(o);
|
|
848
|
+
}
|
|
849
|
+
log(`[otaless] ${still.length} order(s) 13 did not answer for at ${group} could not be verified - the stay is no longer held back`);
|
|
850
|
+
failed.push(failedStay(label, `The earlier booking of this stay could not be confirmed with ${name}: it may have been made, so the guest should check with ${name} before booking it again. Nothing new was booked this time - asked again, a new booking is made.`, 'earlier-unconfirmed'));
|
|
851
|
+
continue;
|
|
852
|
+
}
|
|
853
|
+
if (!rows || still.length) {
|
|
854
|
+
failed.push(failedStay(label, `An earlier booking of this stay is still being looked into with ${name} - whether it was made is not known yet, so nothing new was booked. Look at the bookings again in a few minutes.`));
|
|
760
855
|
continue;
|
|
761
856
|
}
|
|
762
857
|
}
|
|
763
858
|
// A second press, a lost answer, an order found in the list: the order
|
|
764
|
-
// already made for this stay, while it may still be paid
|
|
765
|
-
//
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
859
|
+
// already made for this stay, while it may still be paid. ⚠️ WITH NO TIME
|
|
860
|
+
// TO PAY BY FROM 13, THE PAYMENT STATUS (15) IS ASKED FIRST (总线程's
|
|
861
|
+
// re-review of 0.63.1, 2): closed, it lapses and its link is not handed
|
|
862
|
+
// on again; not known, it is held to `ASSUMED_HOLD_MS`.
|
|
863
|
+
let before;
|
|
864
|
+
for (const o of [...orders.values()].filter((x) => sameStay(x) && x.status === 'awaiting-payment' && !x.needsPerson)) {
|
|
865
|
+
if (!o.payBy)
|
|
866
|
+
await lookAtPayment(acct, who, o, true);
|
|
867
|
+
if (o.status === 'awaiting-payment' && !o.needsPerson && now() < payableUntil(o)) {
|
|
868
|
+
before = o;
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
769
872
|
if (before) {
|
|
770
873
|
booked.push(toBooking(before));
|
|
771
874
|
reused.push(before.id);
|
|
@@ -953,46 +1056,71 @@ export const createOtalessBookings = (deps) => {
|
|
|
953
1056
|
return { status: 'failed' };
|
|
954
1057
|
return {};
|
|
955
1058
|
};
|
|
956
|
-
/**
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1059
|
+
/**
|
|
1060
|
+
* One order's payment, by 15 - at most every `STATUS_EVERY_MS`, or now
|
|
1061
|
+
* (`force`). What it came to: `paid`; `closed` - it can no longer be paid
|
|
1062
|
+
* (the payment status says so, or its time is past): the order lapses and its
|
|
1063
|
+
* link goes; `pending` - still waiting to be paid; `unknown` - not asked, not
|
|
1064
|
+
* answered, or answered with nothing to go by.
|
|
1065
|
+
*
|
|
1066
|
+
* ⚠️ PAID AT ANOTHER AMOUNT IS NOT PAID (总线程's re-review of 0.63.1, 3): a
|
|
1067
|
+
* person looks (`needsPerson`), and no link is handed on.
|
|
1068
|
+
*/
|
|
1069
|
+
const lookAtPayment = async (acct, who, r, force = false) => {
|
|
1070
|
+
if (r.status !== 'awaiting-payment' || r.id.startsWith('pending:') || r.needsPerson)
|
|
1071
|
+
return 'unknown';
|
|
960
1072
|
const last = checkedAt.get(r.id) ?? 0;
|
|
961
|
-
if (now() - last < STATUS_EVERY_MS)
|
|
962
|
-
return;
|
|
1073
|
+
if (!force && now() - last < STATUS_EVERY_MS)
|
|
1074
|
+
return 'unknown';
|
|
963
1075
|
checkedAt.set(r.id, now());
|
|
964
1076
|
try {
|
|
965
1077
|
const s = await withSession(acct, who, (cred) => client.paymentStatus({ unifiedOrderId: r.id, providerCode: r.group }, cred, deps.callerOf(who)));
|
|
966
|
-
const
|
|
1078
|
+
const said = String(s?.status ?? '')
|
|
1079
|
+
.trim()
|
|
1080
|
+
.toUpperCase();
|
|
1081
|
+
const paid = s?.paid === true || said === 'PAID';
|
|
967
1082
|
const amount = moneyOf(s?.amount, s?.currency);
|
|
968
|
-
if (paid &&
|
|
969
|
-
amount &&
|
|
970
|
-
!(same(amount, r.charged) || same(amount, r.quoted) || same(amount, r.quotedUsd))) {
|
|
971
|
-
log(`[otaless] NEEDS A PERSON: ${forTheLog(r.id)} at ${r.group} paid ${amount.currency} ${amount.minor}, not what was asked - status left as it was`);
|
|
972
|
-
return;
|
|
973
|
-
}
|
|
974
1083
|
if (paid) {
|
|
1084
|
+
if (amount && !asked(amount, r)) {
|
|
1085
|
+
r.needsPerson = 'paid-amount';
|
|
1086
|
+
payLinks.delete(r.id);
|
|
1087
|
+
put(r);
|
|
1088
|
+
log(`[otaless] NEEDS A PERSON: ${forTheLog(r.id)} at ${r.group} paid ${amount.currency} ${amount.minor}, not what was asked - not taken as paid`);
|
|
1089
|
+
return 'unknown';
|
|
1090
|
+
}
|
|
975
1091
|
r.paid = true;
|
|
976
1092
|
r.status = 'confirmed';
|
|
1093
|
+
// ⚠️ WHAT WAS PAID, AS SAID: what a refund previews.
|
|
1094
|
+
if (amount)
|
|
1095
|
+
r.paidAmount = amount;
|
|
977
1096
|
payLinks.delete(r.id);
|
|
978
1097
|
put(r);
|
|
1098
|
+
return 'paid';
|
|
979
1099
|
}
|
|
980
|
-
|
|
1100
|
+
if (s?.pollAgain !== true &&
|
|
1101
|
+
(CLOSED_PAYMENT_STATUSES.has(said) || (!!r.payBy && now() > Date.parse(r.payBy)))) {
|
|
981
1102
|
r.status = 'expired';
|
|
982
1103
|
payLinks.delete(r.id);
|
|
983
1104
|
put(r);
|
|
1105
|
+
return 'closed';
|
|
984
1106
|
}
|
|
1107
|
+
if (s?.pollAgain === true || said === 'PENDING' || said === 'PENDING_PAYMENT') {
|
|
1108
|
+
r.pendingSeenAt = iso();
|
|
1109
|
+
put(r);
|
|
1110
|
+
return 'pending';
|
|
1111
|
+
}
|
|
1112
|
+
return 'unknown';
|
|
985
1113
|
}
|
|
986
1114
|
catch (err) {
|
|
987
|
-
if (err instanceof Error && 'code' in err)
|
|
988
|
-
|
|
989
|
-
|
|
1115
|
+
if (!(err instanceof Error && 'code' in err))
|
|
1116
|
+
log(`[otaless] payment status of an order at ${r.group} not read: ${err instanceof Error ? err.name : 'error'}`);
|
|
1117
|
+
return 'unknown';
|
|
990
1118
|
}
|
|
991
1119
|
};
|
|
992
1120
|
/**
|
|
993
1121
|
* The group's order list (12): statuses, a lost payment link, and an order
|
|
994
|
-
* 13 did not answer for.
|
|
995
|
-
* not be (and nothing changed).
|
|
1122
|
+
* 13 did not answer for. The rows when the list was read - undefined when it
|
|
1123
|
+
* could not be (and nothing changed).
|
|
996
1124
|
*
|
|
997
1125
|
* ⚠️ WHAT IS LET GO OR STILL BEING LOOKED FOR IS NOT TOUCHED (总线程's review
|
|
998
1126
|
* of 0.63.0, 3 and 7): a released order gets no status and no payment link
|
|
@@ -1004,7 +1132,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1004
1132
|
rows = await withSession(acct, who, (cred) => client.orders({ providerCode: group }, cred, deps.callerOf(who)));
|
|
1005
1133
|
}
|
|
1006
1134
|
catch {
|
|
1007
|
-
return
|
|
1135
|
+
return undefined;
|
|
1008
1136
|
}
|
|
1009
1137
|
const known = new Set(orders.keys());
|
|
1010
1138
|
for (const row of rows) {
|
|
@@ -1013,9 +1141,22 @@ export const createOtalessBookings = (deps) => {
|
|
|
1013
1141
|
continue;
|
|
1014
1142
|
const r = orders.get(id);
|
|
1015
1143
|
if (r) {
|
|
1016
|
-
if (r.owner !== acct.owner || r.released || r.status === 'unconfirmed')
|
|
1144
|
+
if (r.owner !== acct.owner || r.released || r.status === 'unconfirmed' || r.needsPerson)
|
|
1017
1145
|
continue;
|
|
1018
1146
|
const s = statusOfRow(row.status);
|
|
1147
|
+
// ⚠️ "PAID" AT ANOTHER AMOUNT - OR NONE - IS NOT PAID (总线程's re-review
|
|
1148
|
+
// of 0.63.1, 3): a person looks; nothing else of the row is taken.
|
|
1149
|
+
if (s.paid && !r.paid) {
|
|
1150
|
+
const amount = moneyOf(row.totalAmount, row.currency);
|
|
1151
|
+
if (!amount || !asked(amount, r)) {
|
|
1152
|
+
r.needsPerson = 'paid-amount';
|
|
1153
|
+
payLinks.delete(r.id);
|
|
1154
|
+
put(r);
|
|
1155
|
+
log(`[otaless] NEEDS A PERSON: ${forTheLog(r.id)} at ${group} is listed PAID at ${amount ? `${amount.currency} ${amount.minor}` : 'no amount'}, not what was asked - not taken as paid`);
|
|
1156
|
+
continue;
|
|
1157
|
+
}
|
|
1158
|
+
r.paidAmount ??= amount;
|
|
1159
|
+
}
|
|
1019
1160
|
// ⚠️ AN UNPAID ORDER STAYS WAITING ("CONFIRMED" is not paid, questions
|
|
1020
1161
|
// #53): only PAID, a cancellation or a failure moves it.
|
|
1021
1162
|
if (s.status &&
|
|
@@ -1081,6 +1222,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1081
1222
|
if (s.paid) {
|
|
1082
1223
|
o.status = 'confirmed';
|
|
1083
1224
|
o.paid = true;
|
|
1225
|
+
o.paidAmount = charged;
|
|
1084
1226
|
}
|
|
1085
1227
|
else if (s.status === 'cancelled' || s.status === 'failed') {
|
|
1086
1228
|
o.status = s.status;
|
|
@@ -1095,7 +1237,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1095
1237
|
known.add(id);
|
|
1096
1238
|
put(o);
|
|
1097
1239
|
}
|
|
1098
|
-
return
|
|
1240
|
+
return rows;
|
|
1099
1241
|
};
|
|
1100
1242
|
/** The guest's orders brought up to date, each by their sign-in at its group (`signed`). */
|
|
1101
1243
|
const refresh = async (who, mine, signed) => {
|
|
@@ -1150,7 +1292,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1150
1292
|
return null;
|
|
1151
1293
|
const { r, acct } = own;
|
|
1152
1294
|
await refresh(who, [r], new Map([[r.group, acct]]));
|
|
1153
|
-
const amount = r
|
|
1295
|
+
const amount = paidOf(r);
|
|
1154
1296
|
const base = { bookingId: r.id, supplier: r.group, confirmationCode: r.code || r.id };
|
|
1155
1297
|
const g = deps.groupOf(r.group).name;
|
|
1156
1298
|
if (r.status === 'cancelled' || r.status === 'expired' || r.status === 'failed')
|
|
@@ -1254,7 +1396,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1254
1396
|
break;
|
|
1255
1397
|
refundPreviews.delete(first);
|
|
1256
1398
|
}
|
|
1257
|
-
const amount = r
|
|
1399
|
+
const amount = paidOf(r);
|
|
1258
1400
|
const preview = randomBytes(18).toString('base64url');
|
|
1259
1401
|
refundPreviews.set(preview, { orderId: r.id, owner: r.owner, amount, at: now() });
|
|
1260
1402
|
return {
|
|
@@ -1263,6 +1405,8 @@ export const createOtalessBookings = (deps) => {
|
|
|
1263
1405
|
confirmationCode: r.code || r.id,
|
|
1264
1406
|
supplier: r.group,
|
|
1265
1407
|
amount,
|
|
1408
|
+
fromPayment: !!r.paidAmount,
|
|
1409
|
+
groupDecides: true,
|
|
1266
1410
|
terms: r.terms ?? '',
|
|
1267
1411
|
until: iso(now() + REFUND_PREVIEW_MS),
|
|
1268
1412
|
};
|
|
@@ -1285,7 +1429,7 @@ export const createOtalessBookings = (deps) => {
|
|
|
1285
1429
|
now() - shown.at > REFUND_PREVIEW_MS ||
|
|
1286
1430
|
shown.orderId !== r.id ||
|
|
1287
1431
|
shown.owner !== r.owner ||
|
|
1288
|
-
!same(shown.amount, r
|
|
1432
|
+
!same(shown.amount, paidOf(r)))
|
|
1289
1433
|
throw refusal('refund-preview', 'Nothing was asked: a refund is asked only after the guest was shown what it asks for (the refund preview of this booking) - show it to them again first.');
|
|
1290
1434
|
const why = cleanReason(reason);
|
|
1291
1435
|
// ⚠️ ALL OF IT, NEVER A PART (`amountUsd` is never sent), and no
|