@chevre/domain 21.1.0-alpha.3 → 21.2.0-alpha.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/example/src/chevre/publishConfirmationNumber.ts +27 -0
- package/lib/chevre/repo/action/registerServiceInProgress.js +2 -2
- package/lib/chevre/repo/confirmationNumber.js +7 -7
- package/lib/chevre/repo/itemAvailability/screeningEvent.d.ts +10 -0
- package/lib/chevre/repo/itemAvailability/screeningEvent.js +21 -10
- package/lib/chevre/repo/orderNumber.js +7 -7
- package/lib/chevre/repo/serviceOutputIdentifier.js +3 -3
- package/lib/chevre/repo/transactionNumber.js +3 -3
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +9 -1
- package/lib/chevre/service/assetTransaction/reserve.js +4 -0
- package/lib/chevre/service/offer.js +5 -0
- package/lib/chevre/service/reserve/cancelReservation.js +21 -3
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as redis from 'redis';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
// tslint:disable-next-line:max-func-body-length
|
|
9
|
+
async function main() {
|
|
10
|
+
const client = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
11
|
+
socket: {
|
|
12
|
+
host: process.env.REDIS_HOST,
|
|
13
|
+
port: Number(process.env.REDIS_PORT)
|
|
14
|
+
},
|
|
15
|
+
password: process.env.REDIS_KEY
|
|
16
|
+
});
|
|
17
|
+
await client.connect();
|
|
18
|
+
|
|
19
|
+
const confirmationNumberRepo = new chevre.repository.ConfirmationNumber(client);
|
|
20
|
+
await confirmationNumberRepo.publish({ orderDate: new Date() });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
main()
|
|
24
|
+
.then(() => {
|
|
25
|
+
console.log('success!');
|
|
26
|
+
})
|
|
27
|
+
.catch(console.error);
|
|
@@ -24,13 +24,13 @@ class RedisRepository {
|
|
|
24
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
25
|
const key = `${RedisRepository.KEY_PREFIX}:${progressKey.agent.id}:${progressKey.product.id}`;
|
|
26
26
|
const ttl = 7200;
|
|
27
|
-
const
|
|
27
|
+
const [setNXReply] = yield this.redisClient.multi()
|
|
28
28
|
.setNX(key, holder)
|
|
29
29
|
.expire(key, ttl)
|
|
30
30
|
.exec();
|
|
31
31
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
32
32
|
/* istanbul ignore else: please write tests */
|
|
33
|
-
if (
|
|
33
|
+
if (setNXReply === 1 || setNXReply === true) {
|
|
34
34
|
return true;
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
@@ -44,18 +44,18 @@ class RedisRepository {
|
|
|
44
44
|
const key = util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX, moment(params.orderDate)
|
|
45
45
|
.tz('Asia/Tokyo')
|
|
46
46
|
.format('YYMM'));
|
|
47
|
-
const
|
|
47
|
+
const [incrReply] = yield this.redisClient.multi()
|
|
48
48
|
.incr(key)
|
|
49
49
|
.expire(key, TTL)
|
|
50
50
|
.exec();
|
|
51
|
-
if (!Array.isArray(results)) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
51
|
+
// if (!Array.isArray(results)) {
|
|
52
|
+
// // なぜかresults: nullのことがあるのでハンドリング
|
|
53
|
+
// throw new factory.errors.ServiceUnavailable('incr confirmationNumber result not array');
|
|
54
|
+
// }
|
|
55
55
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
56
56
|
/* istanbul ignore else: please write tests */
|
|
57
|
-
if (typeof
|
|
58
|
-
const no =
|
|
57
|
+
if (typeof incrReply === 'number') {
|
|
58
|
+
const no = incrReply;
|
|
59
59
|
// debug('no incremented.', no);
|
|
60
60
|
// 桁数調整
|
|
61
61
|
let confirmationNumber = RedisRepository.ALIGN_DIGITS(String(no));
|
|
@@ -14,22 +14,29 @@ export interface IOffer {
|
|
|
14
14
|
}
|
|
15
15
|
export interface ILockKey {
|
|
16
16
|
eventId: string;
|
|
17
|
+
startDate: Date;
|
|
17
18
|
offers: IOffer[];
|
|
18
19
|
expires: Date;
|
|
19
20
|
holder: string;
|
|
20
21
|
}
|
|
21
22
|
export interface IUnlockKey {
|
|
22
23
|
eventId: string;
|
|
24
|
+
startDate: Date;
|
|
23
25
|
offer: IOffer;
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* イベントの座席在庫リポジトリ
|
|
27
29
|
*/
|
|
28
30
|
export declare class RedisRepository {
|
|
31
|
+
static KEY_PREFIX_NEW: string;
|
|
29
32
|
static KEY_PREFIX: string;
|
|
30
33
|
private readonly redisClient;
|
|
31
34
|
constructor(redisClient: RedisClientType);
|
|
32
35
|
static OFFER2FIELD(params: IOffer): string;
|
|
36
|
+
static CREATE_KEY(params: {
|
|
37
|
+
eventId: string;
|
|
38
|
+
startDate: Date;
|
|
39
|
+
}): string;
|
|
33
40
|
/**
|
|
34
41
|
* 座席をロックする(maxキャパシティチェック有)
|
|
35
42
|
*/
|
|
@@ -47,6 +54,7 @@ export declare class RedisRepository {
|
|
|
47
54
|
*/
|
|
48
55
|
findUnavailableOffersByEventId(params: {
|
|
49
56
|
eventId: string;
|
|
57
|
+
startDate: Date;
|
|
50
58
|
}): Promise<IOffer[]>;
|
|
51
59
|
/**
|
|
52
60
|
* 空席でない座席をカウントする
|
|
@@ -54,6 +62,7 @@ export declare class RedisRepository {
|
|
|
54
62
|
countUnavailableOffers(params: {
|
|
55
63
|
event: {
|
|
56
64
|
id: string;
|
|
65
|
+
startDate: Date;
|
|
57
66
|
};
|
|
58
67
|
}): Promise<number>;
|
|
59
68
|
/**
|
|
@@ -66,6 +75,7 @@ export declare class RedisRepository {
|
|
|
66
75
|
*/
|
|
67
76
|
searchAvailability(params: {
|
|
68
77
|
eventId: string;
|
|
78
|
+
startDate: Date;
|
|
69
79
|
offers: IOffer[];
|
|
70
80
|
}): Promise<{
|
|
71
81
|
seatSection: string;
|
|
@@ -13,6 +13,7 @@ exports.RedisRepository = void 0;
|
|
|
13
13
|
const createDebug = require("debug");
|
|
14
14
|
const moment = require("moment");
|
|
15
15
|
const factory = require("../../factory");
|
|
16
|
+
const settings_1 = require("../../settings");
|
|
16
17
|
const debug = createDebug('chevre-domain:repo');
|
|
17
18
|
/**
|
|
18
19
|
* イベントの座席在庫リポジトリ
|
|
@@ -30,12 +31,23 @@ class RedisRepository {
|
|
|
30
31
|
}
|
|
31
32
|
return `${params.seatSection}:${params.seatNumber}`;
|
|
32
33
|
}
|
|
34
|
+
static CREATE_KEY(params) {
|
|
35
|
+
const useNewKey = params.startDate instanceof Date
|
|
36
|
+
&& moment(params.startDate)
|
|
37
|
+
.isAfter(settings_1.USE_NEW_EVENT_AVAILABILITY_KEY_FROM);
|
|
38
|
+
if (useNewKey) {
|
|
39
|
+
return `${RedisRepository.KEY_PREFIX_NEW}:${params.eventId}`;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return `${RedisRepository.KEY_PREFIX}:${params.eventId}`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
33
45
|
/**
|
|
34
46
|
* 座席をロックする(maxキャパシティチェック有)
|
|
35
47
|
*/
|
|
36
48
|
lockIfNotLimitExceeded(lockKey, maximum) {
|
|
37
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const key =
|
|
50
|
+
const key = RedisRepository.CREATE_KEY({ eventId: lockKey.eventId, startDate: lockKey.startDate });
|
|
39
51
|
yield this.redisClient.watch(key);
|
|
40
52
|
const hashCount = yield this.redisClient.hLen(key);
|
|
41
53
|
// Process result
|
|
@@ -52,8 +64,7 @@ class RedisRepository {
|
|
|
52
64
|
*/
|
|
53
65
|
lock(lockKey) {
|
|
54
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
|
|
56
|
-
const key = `${RedisRepository.KEY_PREFIX}:${lockKey.eventId}`;
|
|
67
|
+
const key = RedisRepository.CREATE_KEY({ eventId: lockKey.eventId, startDate: lockKey.startDate });
|
|
57
68
|
const value = lockKey.holder;
|
|
58
69
|
const multi = this.redisClient.multi();
|
|
59
70
|
const fields = lockKey.offers.map((offer) => RedisRepository.OFFER2FIELD(offer));
|
|
@@ -92,12 +103,11 @@ class RedisRepository {
|
|
|
92
103
|
*/
|
|
93
104
|
unlock(params) {
|
|
94
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
const key =
|
|
106
|
+
const key = RedisRepository.CREATE_KEY({ eventId: params.eventId, startDate: params.startDate });
|
|
96
107
|
const field = RedisRepository.OFFER2FIELD(params.offer);
|
|
97
|
-
|
|
108
|
+
yield this.redisClient.multi()
|
|
98
109
|
.hDel(key, field)
|
|
99
110
|
.exec();
|
|
100
|
-
debug('reply:', reply);
|
|
101
111
|
});
|
|
102
112
|
}
|
|
103
113
|
/**
|
|
@@ -105,7 +115,7 @@ class RedisRepository {
|
|
|
105
115
|
*/
|
|
106
116
|
findUnavailableOffersByEventId(params) {
|
|
107
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
const key =
|
|
118
|
+
const key = RedisRepository.CREATE_KEY({ eventId: params.eventId, startDate: params.startDate });
|
|
109
119
|
const reply = yield this.redisClient.hGetAll(key);
|
|
110
120
|
let offers = [];
|
|
111
121
|
if (reply !== null) {
|
|
@@ -124,7 +134,7 @@ class RedisRepository {
|
|
|
124
134
|
*/
|
|
125
135
|
countUnavailableOffers(params) {
|
|
126
136
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
const key =
|
|
137
|
+
const key = RedisRepository.CREATE_KEY({ eventId: params.event.id, startDate: params.event.startDate });
|
|
128
138
|
const reply = yield this.redisClient.hLen(key);
|
|
129
139
|
let fieldCount = 0;
|
|
130
140
|
if (typeof reply === 'number') {
|
|
@@ -138,7 +148,7 @@ class RedisRepository {
|
|
|
138
148
|
*/
|
|
139
149
|
getHolder(params) {
|
|
140
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
const key =
|
|
151
|
+
const key = RedisRepository.CREATE_KEY({ eventId: params.eventId, startDate: params.startDate });
|
|
142
152
|
const field = RedisRepository.OFFER2FIELD(params.offer);
|
|
143
153
|
return this.redisClient.hGet(key, field);
|
|
144
154
|
});
|
|
@@ -149,7 +159,7 @@ class RedisRepository {
|
|
|
149
159
|
*/
|
|
150
160
|
searchAvailability(params) {
|
|
151
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
-
const key =
|
|
162
|
+
const key = RedisRepository.CREATE_KEY({ eventId: params.eventId, startDate: params.startDate });
|
|
153
163
|
const fields = params.offers.map((o) => {
|
|
154
164
|
return RedisRepository.OFFER2FIELD(o);
|
|
155
165
|
});
|
|
@@ -166,5 +176,6 @@ class RedisRepository {
|
|
|
166
176
|
});
|
|
167
177
|
}
|
|
168
178
|
}
|
|
179
|
+
RedisRepository.KEY_PREFIX_NEW = 'stockHolder';
|
|
169
180
|
RedisRepository.KEY_PREFIX = 'chevre:itemAvailability:screeningEvent';
|
|
170
181
|
exports.RedisRepository = RedisRepository;
|
|
@@ -38,19 +38,19 @@ class RedisRepository {
|
|
|
38
38
|
.add(1, 'minute') // ミリ秒でカウントしていくので、注文日時後1分で十分
|
|
39
39
|
.diff(now, 'seconds');
|
|
40
40
|
const key = util.format('%s:%s:%s', RedisRepository.REDIS_KEY_PREFIX, projectPrefix, timestamp);
|
|
41
|
-
const
|
|
41
|
+
const [incrReply] = yield this.redisClient.multi()
|
|
42
42
|
.incr(key)
|
|
43
43
|
.expire(key, TTL)
|
|
44
44
|
.exec();
|
|
45
|
-
if (!Array.isArray(results)) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
45
|
+
// if (!Array.isArray(results)) {
|
|
46
|
+
// // なぜかresults: nullのことがあるのでハンドリング
|
|
47
|
+
// throw new factory.errors.ServiceUnavailable('incr orderNumber result not array');
|
|
48
|
+
// }
|
|
49
49
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
50
50
|
/* istanbul ignore else: please write tests */
|
|
51
|
-
if (typeof
|
|
51
|
+
if (typeof incrReply === 'number') {
|
|
52
52
|
let orderNumber = timestamp;
|
|
53
|
-
const no =
|
|
53
|
+
const no = incrReply;
|
|
54
54
|
orderNumber = `${orderNumber}${no}`;
|
|
55
55
|
// checkdigit
|
|
56
56
|
const cd = cdigit.luhn.compute(orderNumber);
|
|
@@ -36,15 +36,15 @@ class RedisRepository {
|
|
|
36
36
|
.add(1, 'minute') // ミリ秒でカウントしていくので、予約日時後1分で十分
|
|
37
37
|
.diff(now, 'seconds');
|
|
38
38
|
const key = util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX, timestamp);
|
|
39
|
-
const
|
|
39
|
+
const [incrReply] = yield this.redisClient.multi()
|
|
40
40
|
.incr(key)
|
|
41
41
|
.expire(key, TTL)
|
|
42
42
|
.exec();
|
|
43
43
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
44
44
|
/* istanbul ignore else: please write tests */
|
|
45
|
-
if (
|
|
45
|
+
if (typeof incrReply === 'number') {
|
|
46
46
|
let identifier = timestamp;
|
|
47
|
-
const no =
|
|
47
|
+
const no = incrReply;
|
|
48
48
|
identifier = `${identifier}${no}`;
|
|
49
49
|
// checkdigit
|
|
50
50
|
const cd = cdigit.luhn.compute(identifier);
|
|
@@ -36,15 +36,15 @@ class RedisRepository {
|
|
|
36
36
|
.add(1, 'minute') // ミリ秒でカウントしていくので、予約日時後1分で十分
|
|
37
37
|
.diff(now, 'seconds');
|
|
38
38
|
const key = util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX, timestamp);
|
|
39
|
-
const
|
|
39
|
+
const [incrReply] = yield this.redisClient.multi()
|
|
40
40
|
.incr(key)
|
|
41
41
|
.expire(key, TTL)
|
|
42
42
|
.exec();
|
|
43
43
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
44
44
|
/* istanbul ignore else: please write tests */
|
|
45
|
-
if (
|
|
45
|
+
if (typeof incrReply === 'number') {
|
|
46
46
|
let transactionNumber = timestamp;
|
|
47
|
-
const no =
|
|
47
|
+
const no = incrReply;
|
|
48
48
|
transactionNumber = `${transactionNumber}${no}`;
|
|
49
49
|
// checkdigit
|
|
50
50
|
const cd = cdigit.luhn.compute(transactionNumber);
|
|
@@ -389,6 +389,8 @@ function filterByEligibleSeatingType(params) {
|
|
|
389
389
|
if (maximumAttendeeCapacity > 0) {
|
|
390
390
|
const availabilities = yield repos.eventAvailability.searchAvailability({
|
|
391
391
|
eventId: params.event.id,
|
|
392
|
+
startDate: moment(params.event.startDate)
|
|
393
|
+
.toDate(),
|
|
392
394
|
offers: eligibleSeatOffers
|
|
393
395
|
});
|
|
394
396
|
remainingAttendeeCapacity = availabilities.filter((a) => a.availability === factory.itemAvailability.InStock).length;
|
|
@@ -436,7 +438,13 @@ function aggregateReservationByEvent(params) {
|
|
|
436
438
|
// remainingAttendeeCapacityを決定
|
|
437
439
|
if (typeof maximumAttendeeCapacity === 'number') {
|
|
438
440
|
// 残席数を座席ロック数から計算
|
|
439
|
-
const unavailableOfferCount = yield repos.eventAvailability.countUnavailableOffers({
|
|
441
|
+
const unavailableOfferCount = yield repos.eventAvailability.countUnavailableOffers({
|
|
442
|
+
event: {
|
|
443
|
+
id: params.event.id,
|
|
444
|
+
startDate: moment(params.event.startDate)
|
|
445
|
+
.toDate()
|
|
446
|
+
}
|
|
447
|
+
});
|
|
440
448
|
remainingAttendeeCapacity = maximumAttendeeCapacity - unavailableOfferCount;
|
|
441
449
|
if (remainingAttendeeCapacity < 0) {
|
|
442
450
|
remainingAttendeeCapacity = 0;
|
|
@@ -577,6 +577,8 @@ function processLockSeats(params) {
|
|
|
577
577
|
if (typeof maximumAttendeeCapacity4event === 'number') {
|
|
578
578
|
yield repos.eventAvailability.lockIfNotLimitExceeded({
|
|
579
579
|
eventId: params.event.id,
|
|
580
|
+
startDate: moment(params.event.startDate)
|
|
581
|
+
.toDate(),
|
|
580
582
|
offers,
|
|
581
583
|
expires,
|
|
582
584
|
holder
|
|
@@ -585,6 +587,8 @@ function processLockSeats(params) {
|
|
|
585
587
|
else {
|
|
586
588
|
yield repos.eventAvailability.lock({
|
|
587
589
|
eventId: params.event.id,
|
|
590
|
+
startDate: moment(params.event.startDate)
|
|
591
|
+
.toDate(),
|
|
588
592
|
offers,
|
|
589
593
|
expires,
|
|
590
594
|
holder
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.createAggregateScreeningEventIfNotExist = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.searchEventSeatOffers = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
13
|
+
const moment = require("moment");
|
|
13
14
|
const factory = require("../factory");
|
|
14
15
|
const EventOfferService = require("./offer/event");
|
|
15
16
|
exports.event = EventOfferService;
|
|
@@ -111,6 +112,8 @@ function searchEventSeatOffers(params) {
|
|
|
111
112
|
if (seats.length > 0) {
|
|
112
113
|
const availabilities = yield repos.eventAvailability.searchAvailability({
|
|
113
114
|
eventId: params.event.id,
|
|
115
|
+
startDate: moment(event.startDate)
|
|
116
|
+
.toDate(),
|
|
114
117
|
offers: seats.map((s) => {
|
|
115
118
|
var _a;
|
|
116
119
|
return {
|
|
@@ -182,6 +185,8 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
182
185
|
if (seats.length > 0) {
|
|
183
186
|
const availabilities = yield repos.eventAvailability.searchAvailability({
|
|
184
187
|
eventId: params.event.id,
|
|
188
|
+
startDate: moment(event.startDate)
|
|
189
|
+
.toDate(),
|
|
185
190
|
offers: seats.map((s) => {
|
|
186
191
|
var _a;
|
|
187
192
|
return {
|
|
@@ -62,7 +62,12 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
62
62
|
id: cancelingSubReservation.id,
|
|
63
63
|
reservedTicket: cancelingSubReservation.reservedTicket,
|
|
64
64
|
subReservation: cancelingSubReservation.subReservation,
|
|
65
|
-
reservationFor: {
|
|
65
|
+
reservationFor: {
|
|
66
|
+
id: String(reservationFor.id),
|
|
67
|
+
startDate: (reservationFor.typeOf === factory.eventType.ScreeningEvent)
|
|
68
|
+
? reservationFor.startDate
|
|
69
|
+
: reservationFor.departureTime
|
|
70
|
+
}
|
|
66
71
|
},
|
|
67
72
|
expectedHolder: reserveTransactionId
|
|
68
73
|
})(repos);
|
|
@@ -199,7 +204,12 @@ function cancelReservation(actionAttributesList) {
|
|
|
199
204
|
id: cancelingSubReservation.id,
|
|
200
205
|
reservedTicket: cancelingSubReservation.reservedTicket,
|
|
201
206
|
subReservation: cancelingSubReservation.subReservation,
|
|
202
|
-
reservationFor: {
|
|
207
|
+
reservationFor: {
|
|
208
|
+
id: String(reservationFor.id),
|
|
209
|
+
startDate: (reservationFor.typeOf === factory.eventType.ScreeningEvent)
|
|
210
|
+
? reservationFor.startDate
|
|
211
|
+
: reservationFor.departureTime
|
|
212
|
+
}
|
|
203
213
|
},
|
|
204
214
|
expectedHolder: reserveTransaction.id
|
|
205
215
|
})(repos);
|
|
@@ -241,7 +251,10 @@ function cancelReservation(actionAttributesList) {
|
|
|
241
251
|
id: reservation.id,
|
|
242
252
|
reservedTicket: reservation.reservedTicket,
|
|
243
253
|
subReservation: reservation.subReservation,
|
|
244
|
-
reservationFor: {
|
|
254
|
+
reservationFor: {
|
|
255
|
+
id: reservation.reservationFor.id,
|
|
256
|
+
startDate: reservation.reservationFor.startDate
|
|
257
|
+
}
|
|
245
258
|
},
|
|
246
259
|
expectedHolder
|
|
247
260
|
})(repos);
|
|
@@ -319,9 +332,12 @@ exports.cancelReservation = cancelReservation;
|
|
|
319
332
|
function processUnlockSeat(params) {
|
|
320
333
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
321
334
|
const reservation = params.reservation;
|
|
335
|
+
const eventStartDate = moment(reservation.reservationFor.startDate)
|
|
336
|
+
.toDate();
|
|
322
337
|
// 予約IDでロックされていれば解除
|
|
323
338
|
let lockKey = {
|
|
324
339
|
eventId: reservation.reservationFor.id,
|
|
340
|
+
startDate: eventStartDate,
|
|
325
341
|
offer: {
|
|
326
342
|
itemOffered: { serviceOutput: { id: reservation.id } },
|
|
327
343
|
seatNumber: '',
|
|
@@ -337,6 +353,7 @@ function processUnlockSeat(params) {
|
|
|
337
353
|
if (ticketedSeat !== undefined) {
|
|
338
354
|
lockKey = {
|
|
339
355
|
eventId: reservation.reservationFor.id,
|
|
356
|
+
startDate: eventStartDate,
|
|
340
357
|
offer: {
|
|
341
358
|
seatNumber: ticketedSeat.seatNumber,
|
|
342
359
|
seatSection: ticketedSeat.seatSection
|
|
@@ -357,6 +374,7 @@ function processUnlockSeat(params) {
|
|
|
357
374
|
if (typeof seatSection4sub === 'string' && typeof seatNumber4sub === 'string') {
|
|
358
375
|
const lockKey4sub = {
|
|
359
376
|
eventId: reservation.reservationFor.id,
|
|
377
|
+
startDate: eventStartDate,
|
|
360
378
|
offer: {
|
|
361
379
|
seatNumber: seatNumber4sub,
|
|
362
380
|
seatSection: seatSection4sub
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as moment from 'moment';
|
|
1
2
|
import * as factory from './factory';
|
|
2
3
|
export declare const ABORTED_TASKS_WITHOUT_REPORT: string[];
|
|
3
4
|
/**
|
|
@@ -28,6 +29,7 @@ export type ISettings = factory.project.ISettings & {
|
|
|
28
29
|
export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
|
|
29
30
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
30
31
|
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
32
|
+
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
|
31
33
|
/**
|
|
32
34
|
* グローバル設定
|
|
33
35
|
*/
|
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settings = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = void 0;
|
|
3
|
+
exports.settings = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = void 0;
|
|
4
|
+
const moment = require("moment");
|
|
4
5
|
const factory = require("./factory");
|
|
5
6
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
6
7
|
? process.env.INFORM_TRANSACTION_URL.split(' ')
|
|
@@ -45,6 +46,9 @@ exports.DEFAULT_SENDER_EMAIL = process.env.DEFAULT_SENDER_EMAIL;
|
|
|
45
46
|
exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = String(process.env.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD);
|
|
46
47
|
exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
47
48
|
exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
49
|
+
exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
|
|
50
|
+
? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
|
|
51
|
+
: moment('2023-07-23T15:00:00Z');
|
|
48
52
|
/**
|
|
49
53
|
* グローバル設定
|
|
50
54
|
*/
|
package/package.json
CHANGED