@chevre/domain 20.2.0-alpha.8 → 20.2.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/aggregateEventReservation.ts +37 -0
- package/example/src/chevre/aggregation/aggregateSystem.ts +116 -0
- package/example/src/chevre/attendIfNotAttended.ts +22 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +209 -0
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +20 -0
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +27 -0
- package/example/src/chevre/importEventsFromCOA.ts +8 -1
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +2 -1
- package/example/src/chevre/migrateOwnershipInfos2newUserPool.ts +1 -1
- package/example/src/chevre/migrateProjectSubscription.ts +51 -0
- package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +2 -2
- package/example/src/chevre/processReserve.ts +2 -0
- package/example/src/chevre/searchEventIds.ts +24 -0
- package/example/src/chevre/searchEventTicketOffers.ts +5 -4
- package/example/src/chevre/searchEvents.ts +20 -41
- package/example/src/chevre/searchOffersByCatalog.ts +27 -0
- package/example/src/chevre/updateTransaction.ts +38 -0
- package/lib/chevre/factory/event.d.ts +2 -0
- package/lib/chevre/factory/event.js +2 -0
- package/lib/chevre/repo/action.d.ts +77 -1
- package/lib/chevre/repo/action.js +249 -6
- package/lib/chevre/repo/aggregation.d.ts +38 -0
- package/lib/chevre/repo/aggregation.js +68 -0
- package/lib/chevre/repo/assetTransaction.d.ts +32 -0
- package/lib/chevre/repo/assetTransaction.js +148 -0
- package/lib/chevre/repo/code.d.ts +13 -16
- package/lib/chevre/repo/code.js +33 -19
- package/lib/chevre/repo/creativeWork.js +13 -12
- package/lib/chevre/repo/event.d.ts +64 -17
- package/lib/chevre/repo/event.js +456 -156
- package/lib/chevre/repo/mongoose/model/aggregation.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/aggregation.js +47 -0
- package/lib/chevre/repo/mongoose/model/event.js +4 -3
- package/lib/chevre/repo/mongoose/model/offer.js +2 -1
- package/lib/chevre/repo/mongoose/model/project.js +7 -1
- package/lib/chevre/repo/mongoose/model/telemetry.js +4 -28
- package/lib/chevre/repo/offer.d.ts +10 -0
- package/lib/chevre/repo/offer.js +47 -16
- package/lib/chevre/repo/order.d.ts +6 -0
- package/lib/chevre/repo/order.js +53 -7
- package/lib/chevre/repo/place.d.ts +26 -1
- package/lib/chevre/repo/place.js +216 -12
- package/lib/chevre/repo/product.d.ts +1 -0
- package/lib/chevre/repo/product.js +5 -0
- package/lib/chevre/repo/project.d.ts +7 -1
- package/lib/chevre/repo/project.js +15 -6
- package/lib/chevre/repo/reservation.d.ts +7 -8
- package/lib/chevre/repo/reservation.js +181 -76
- package/lib/chevre/repo/task.d.ts +31 -4
- package/lib/chevre/repo/task.js +146 -33
- package/lib/chevre/repo/transaction.d.ts +57 -5
- package/lib/chevre/repo/transaction.js +228 -34
- package/lib/chevre/repo/trip.js +33 -27
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +86 -68
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +5 -8
- package/lib/chevre/service/aggregation/system.d.ts +100 -0
- package/lib/chevre/service/aggregation/system.js +409 -0
- package/lib/chevre/service/aggregation.d.ts +2 -0
- package/lib/chevre/service/aggregation.js +3 -1
- package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.js +5 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +2 -4
- package/lib/chevre/service/assetTransaction/pay.d.ts +19 -4
- package/lib/chevre/service/assetTransaction/pay.js +65 -32
- package/lib/chevre/service/assetTransaction/registerService.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +3 -0
- package/lib/chevre/service/assetTransaction/reserve/factory.js +33 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +84 -0
- package/lib/chevre/service/assetTransaction/reserve.d.ts +38 -6
- package/lib/chevre/service/assetTransaction/reserve.js +120 -94
- package/lib/chevre/service/assetTransaction.d.ts +1 -1
- package/lib/chevre/service/code.d.ts +2 -3
- package/lib/chevre/service/delivery/factory.d.ts +1 -1
- package/lib/chevre/service/delivery/product/factory.js +9 -3
- package/lib/chevre/service/event.d.ts +2 -4
- package/lib/chevre/service/event.js +35 -14
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -7
- package/lib/chevre/service/offer/event/authorize.js +33 -87
- package/lib/chevre/service/offer/event/cancel.js +0 -1
- package/lib/chevre/service/offer/event/factory.d.ts +3 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +14 -7
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +95 -53
- package/lib/chevre/service/offer/event/voidTransaction.js +0 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA.js +10 -2
- package/lib/chevre/service/offer/factory.js +10 -3
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +1 -0
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/offer/product.d.ts +1 -0
- package/lib/chevre/service/offer/product.js +7 -2
- package/lib/chevre/service/offer.d.ts +13 -2
- package/lib/chevre/service/offer.js +68 -46
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +25 -27
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
- package/lib/chevre/service/order/placeOrder.js +16 -0
- package/lib/chevre/service/order/returnOrder.js +6 -4
- package/lib/chevre/service/order/sendOrder.js +4 -2
- package/lib/chevre/service/payment/any.d.ts +9 -0
- package/lib/chevre/service/payment/any.js +16 -1
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket.js +8 -2
- package/lib/chevre/service/product.js +5 -3
- package/lib/chevre/service/report/telemetry.js +1 -1
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +7 -10
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +32 -35
- package/lib/chevre/service/reserve/useReservation.d.ts +0 -3
- package/lib/chevre/service/reserve/useReservation.js +58 -32
- package/lib/chevre/service/task/confirmPayTransaction.js +20 -1
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -0
- package/lib/chevre/service/task/confirmReserveTransaction.js +5 -5
- package/lib/chevre/service/task/importEventsFromCOA.js +3 -1
- package/lib/chevre/service/task/returnPayTransaction.js +10 -4
- package/lib/chevre/service/task.js +6 -9
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.d.ts +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +6 -6
- package/lib/chevre/service/transaction/placeOrder.js +5 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +0 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +2 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +3 -8
- package/lib/chevre/service/transaction/placeOrderInProgress.js +92 -107
- package/lib/chevre/service/transaction/returnOrder.js +8 -6
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +20 -12
- package/package.json +3 -3
- package/CHANGELOG.md +0 -2030
- package/example/.gitignore +0 -1
- package/example/src/chevre/.gitignore +0 -1
- package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmPay.d.ts +0 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmPay.js +0 -65
|
@@ -19,8 +19,8 @@ const factory_1 = require("../factory");
|
|
|
19
19
|
function searchTransportationEventTicketOffers(params) {
|
|
20
20
|
// tslint:disable-next-line:max-func-body-length
|
|
21
21
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
var _a, _b, _c;
|
|
23
|
-
const screeningEvent =
|
|
22
|
+
var _a, _b, _c, _d;
|
|
23
|
+
const screeningEvent = params.event;
|
|
24
24
|
const soundFormatTypes = [];
|
|
25
25
|
const videoFormatTypes = [];
|
|
26
26
|
let availableOffers = [];
|
|
@@ -30,7 +30,10 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
30
30
|
const transportation = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
31
31
|
if (typeof ((_b = transportation.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
32
32
|
availableOffers = yield repos.offer.findOffersByOfferCatalogId({
|
|
33
|
-
|
|
33
|
+
ids: params.ids,
|
|
34
|
+
offerCatalog: { id: transportation.hasOfferCatalog.id },
|
|
35
|
+
availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id },
|
|
36
|
+
sort: params.sort
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
}
|
|
@@ -39,10 +42,6 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
39
42
|
throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
40
43
|
}
|
|
41
44
|
const { soundFormatChargeSpecifications, videoFormatChargeSpecifications, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({ project: { id: screeningEvent.project.id }, soundFormatTypes, videoFormatTypes })(repos);
|
|
42
|
-
const screeningEventOfferSettings = screeningEvent.offers;
|
|
43
|
-
if (screeningEventOfferSettings === undefined) {
|
|
44
|
-
throw new factory.errors.NotFound('event.offers');
|
|
45
|
-
}
|
|
46
45
|
const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event: screeningEvent });
|
|
47
46
|
// 不許可決済方法があれば、該当オファーを除外
|
|
48
47
|
if (Array.isArray(unacceptedPaymentMethod) && unacceptedPaymentMethod.length > 0) {
|
|
@@ -94,7 +93,7 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
94
93
|
});
|
|
95
94
|
let offers4event = availableOffers.map((availableOffer) => {
|
|
96
95
|
return (0, factory_1.createCompoundPriceSpec4event)({
|
|
97
|
-
eligibleQuantity:
|
|
96
|
+
eligibleQuantity: eventOffers.eligibleQuantity,
|
|
98
97
|
offer: availableOffer,
|
|
99
98
|
videoFormatChargeSpecifications,
|
|
100
99
|
soundFormatChargeSpecifications,
|
|
@@ -102,25 +101,33 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
102
101
|
videoFormatTypes
|
|
103
102
|
});
|
|
104
103
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
if (params.validateOfferRateLimit) {
|
|
105
|
+
// レート制限を確認
|
|
106
|
+
offers4event = yield Promise.all(offers4event.map((offer) => __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
return checkAvailability({ event: screeningEvent, offer })(repos);
|
|
108
|
+
})));
|
|
109
|
+
}
|
|
109
110
|
// アドオン設定があれば、プロダクトオファーを検索
|
|
110
111
|
for (const offer of offers4event) {
|
|
111
112
|
const offerAddOn = [];
|
|
112
113
|
if (Array.isArray(offer.addOn)) {
|
|
113
114
|
for (const addOn of offer.addOn) {
|
|
114
|
-
const productId = (
|
|
115
|
+
const productId = (_d = addOn.itemOffered) === null || _d === void 0 ? void 0 : _d.id;
|
|
115
116
|
if (typeof productId === 'string') {
|
|
116
|
-
const productOffers = yield searchAddOns({
|
|
117
|
+
const productOffers = yield searchAddOns({
|
|
118
|
+
product: { id: productId },
|
|
119
|
+
store: params.store
|
|
120
|
+
})(repos);
|
|
117
121
|
offerAddOn.push(...productOffers);
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
125
|
offer.addOn = offerAddOn;
|
|
122
126
|
}
|
|
123
|
-
return
|
|
127
|
+
return {
|
|
128
|
+
ticketOffers: offers4event,
|
|
129
|
+
unitPriceOffers: availableOffers
|
|
130
|
+
};
|
|
124
131
|
});
|
|
125
132
|
}
|
|
126
133
|
/**
|
|
@@ -129,9 +136,12 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
129
136
|
function searchScreeningEventTicketOffers(params) {
|
|
130
137
|
// tslint:disable-next-line:max-func-body-length
|
|
131
138
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
132
|
-
var _a, _b, _c;
|
|
133
|
-
|
|
134
|
-
const
|
|
139
|
+
var _a, _b, _c, _d;
|
|
140
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
141
|
+
// const screeningEvent = await repos.event.findById<factory.eventType.ScreeningEvent>({ id: params.eventId });
|
|
142
|
+
const screeningEvent = params.event;
|
|
143
|
+
// 取得属性最適化(2023-01-25~)
|
|
144
|
+
const superEvent = yield repos.event.findById({ id: screeningEvent.superEvent.id }, { soundFormat: 1, videoFormat: 1 });
|
|
135
145
|
const soundFormatTypes = (Array.isArray(superEvent.soundFormat)) ? superEvent.soundFormat.map((f) => f.typeOf) : [];
|
|
136
146
|
const videoFormatTypes = (Array.isArray(superEvent.videoFormat)) ? superEvent.videoFormat.map((f) => f.typeOf) : [];
|
|
137
147
|
let availableOffers = [];
|
|
@@ -141,7 +151,10 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
141
151
|
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
142
152
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
143
153
|
availableOffers = yield repos.offer.findOffersByOfferCatalogId({
|
|
144
|
-
|
|
154
|
+
ids: params.ids,
|
|
155
|
+
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
156
|
+
availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id },
|
|
157
|
+
sort: params.sort
|
|
145
158
|
});
|
|
146
159
|
}
|
|
147
160
|
}
|
|
@@ -150,10 +163,6 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
150
163
|
throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
151
164
|
}
|
|
152
165
|
const { soundFormatChargeSpecifications, videoFormatChargeSpecifications, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({ project: { id: screeningEvent.project.id }, soundFormatTypes, videoFormatTypes })(repos);
|
|
153
|
-
const screeningEventOfferSettings = screeningEvent.offers;
|
|
154
|
-
if (screeningEventOfferSettings === undefined) {
|
|
155
|
-
throw new factory.errors.NotFound('event.offers');
|
|
156
|
-
}
|
|
157
166
|
const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event: screeningEvent });
|
|
158
167
|
// 不許可決済方法があれば、該当オファーを除外
|
|
159
168
|
if (Array.isArray(unacceptedPaymentMethod) && unacceptedPaymentMethod.length > 0) {
|
|
@@ -205,7 +214,7 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
205
214
|
});
|
|
206
215
|
let offers4event = availableOffers.map((availableOffer) => {
|
|
207
216
|
return (0, factory_1.createCompoundPriceSpec4event)({
|
|
208
|
-
eligibleQuantity:
|
|
217
|
+
eligibleQuantity: eventOffers.eligibleQuantity,
|
|
209
218
|
offer: availableOffer,
|
|
210
219
|
videoFormatChargeSpecifications,
|
|
211
220
|
soundFormatChargeSpecifications,
|
|
@@ -213,16 +222,18 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
213
222
|
videoFormatTypes
|
|
214
223
|
});
|
|
215
224
|
});
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
if (params.validateOfferRateLimit) {
|
|
226
|
+
// レート制限を確認
|
|
227
|
+
offers4event = yield Promise.all(offers4event.map((offer) => __awaiter(this, void 0, void 0, function* () {
|
|
228
|
+
return checkAvailability({ event: screeningEvent, offer })(repos);
|
|
229
|
+
})));
|
|
230
|
+
}
|
|
220
231
|
// アドオン設定があれば、プロダクトオファーを検索
|
|
221
232
|
for (const offer of offers4event) {
|
|
222
233
|
const offerAddOn = [];
|
|
223
234
|
if (Array.isArray(offer.addOn)) {
|
|
224
235
|
for (const addOn of offer.addOn) {
|
|
225
|
-
const productId = (
|
|
236
|
+
const productId = (_d = addOn.itemOffered) === null || _d === void 0 ? void 0 : _d.id;
|
|
226
237
|
if (typeof productId === 'string') {
|
|
227
238
|
const productOffers = yield searchAddOns({ product: { id: productId } })(repos);
|
|
228
239
|
offerAddOn.push(...productOffers);
|
|
@@ -231,7 +242,10 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
231
242
|
}
|
|
232
243
|
offer.addOn = offerAddOn;
|
|
233
244
|
}
|
|
234
|
-
return
|
|
245
|
+
return {
|
|
246
|
+
ticketOffers: offers4event,
|
|
247
|
+
unitPriceOffers: availableOffers
|
|
248
|
+
};
|
|
235
249
|
});
|
|
236
250
|
}
|
|
237
251
|
function getUnacceptedPaymentMethodByEvent(params) {
|
|
@@ -321,14 +335,18 @@ function checkAvailability(params) {
|
|
|
321
335
|
*/
|
|
322
336
|
function searchAddOns(params) {
|
|
323
337
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
324
|
-
var _a, _b;
|
|
338
|
+
var _a, _b, _c;
|
|
325
339
|
let offers = [];
|
|
326
340
|
const productId = (_a = params.product) === null || _a === void 0 ? void 0 : _a.id;
|
|
327
341
|
if (typeof productId === 'string') {
|
|
328
342
|
const productWithAddOns = yield repos.product.findById({ id: productId });
|
|
329
343
|
const offerCatalogId = (_b = productWithAddOns.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id;
|
|
330
344
|
if (typeof offerCatalogId === 'string') {
|
|
331
|
-
offers = yield repos.offer.findOffersByOfferCatalogId({
|
|
345
|
+
offers = yield repos.offer.findOffersByOfferCatalogId({
|
|
346
|
+
offerCatalog: { id: offerCatalogId },
|
|
347
|
+
availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id },
|
|
348
|
+
sort: true
|
|
349
|
+
});
|
|
332
350
|
offers = offers.map((o) => {
|
|
333
351
|
return Object.assign(Object.assign({ additionalProperty: Array.isArray(o.additionalProperty) ? o.additionalProperty : [], alternateName: o.alternateName, availability: o.availability, availableAtOrFrom: o.availableAtOrFrom, color: o.color, description: o.description, id: o.id, identifier: o.identifier, itemOffered: {
|
|
334
352
|
description: productWithAddOns.description,
|
|
@@ -347,14 +365,18 @@ function searchAddOns(params) {
|
|
|
347
365
|
/**
|
|
348
366
|
* 興行オファー検索
|
|
349
367
|
*/
|
|
350
|
-
// tslint:disable-next-line:max-func-body-length
|
|
351
368
|
function searchEventTicketOffers(params) {
|
|
369
|
+
// tslint:disable-next-line:max-func-body-length
|
|
352
370
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
353
|
-
var _a;
|
|
354
371
|
const now = moment();
|
|
355
372
|
let event;
|
|
356
|
-
|
|
373
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
374
|
+
// event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>({ id: params.event.id });
|
|
375
|
+
event = yield repos.event.findMinimizedIndividualEventById({
|
|
376
|
+
id: params.event.id
|
|
377
|
+
});
|
|
357
378
|
let offers;
|
|
379
|
+
let unitPriceOffers;
|
|
358
380
|
const eventOffers = event.offers;
|
|
359
381
|
if (eventOffers === undefined) {
|
|
360
382
|
throw new factory.errors.NotFound('EventOffers', 'Event offers undefined');
|
|
@@ -368,22 +390,39 @@ function searchEventTicketOffers(params) {
|
|
|
368
390
|
default:
|
|
369
391
|
// Chevreで券種オファーを検索
|
|
370
392
|
if (event.typeOf === factory.eventType.ScreeningEvent) {
|
|
371
|
-
|
|
393
|
+
const searchOffersResult = yield searchScreeningEventTicketOffers({
|
|
394
|
+
ids: params.ids,
|
|
395
|
+
event,
|
|
396
|
+
store: params.store,
|
|
397
|
+
sort: params.sort,
|
|
398
|
+
validateOfferRateLimit: params.validateOfferRateLimit
|
|
399
|
+
})(repos);
|
|
400
|
+
offers = searchOffersResult.ticketOffers;
|
|
401
|
+
unitPriceOffers = searchOffersResult.unitPriceOffers;
|
|
372
402
|
}
|
|
373
403
|
else if (event.typeOf === factory.eventType.Event) {
|
|
374
|
-
|
|
404
|
+
const searchOffersResult = yield searchTransportationEventTicketOffers({
|
|
405
|
+
ids: params.ids,
|
|
406
|
+
event,
|
|
407
|
+
store: params.store,
|
|
408
|
+
sort: params.sort,
|
|
409
|
+
validateOfferRateLimit: params.validateOfferRateLimit
|
|
410
|
+
})(repos);
|
|
411
|
+
offers = searchOffersResult.ticketOffers;
|
|
412
|
+
unitPriceOffers = searchOffersResult.unitPriceOffers;
|
|
375
413
|
}
|
|
376
414
|
else {
|
|
377
415
|
throw new factory.errors.NotImplemented(`'${event.typeOf}' not implemented`);
|
|
378
416
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
417
|
+
// store.idでのフィルターをmongoに移行(2023-01-27~)
|
|
418
|
+
// const specifiedStoreId = params.store?.id;
|
|
419
|
+
// if (typeof specifiedStoreId === 'string') {
|
|
420
|
+
// // アプリケーションが利用可能なオファーに絞る
|
|
421
|
+
// offers = offers.filter((o) => {
|
|
422
|
+
// return Array.isArray(o.availableAtOrFrom)
|
|
423
|
+
// && o.availableAtOrFrom.some((availableApplication) => availableApplication.id === specifiedStoreId);
|
|
424
|
+
// });
|
|
425
|
+
// }
|
|
387
426
|
// 有効期間を適用
|
|
388
427
|
if (params.onlyValid === true) {
|
|
389
428
|
offers = offers.filter((o) => {
|
|
@@ -401,14 +440,17 @@ function searchEventTicketOffers(params) {
|
|
|
401
440
|
}
|
|
402
441
|
for (const offer of offers) {
|
|
403
442
|
if (Array.isArray(offer.addOn)) {
|
|
443
|
+
// store.idでのフィルターをmongoに移行(2023-01-27~)
|
|
404
444
|
// addOnsに対しても利用可能アプリケーション設定を適用
|
|
405
|
-
if (typeof specifiedStoreId === 'string') {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
445
|
+
// if (typeof specifiedStoreId === 'string') {
|
|
446
|
+
// // アプリケーションが利用可能なオファーに絞る
|
|
447
|
+
// offer.addOn = offer.addOn.filter((offer4addOn) => {
|
|
448
|
+
// return Array.isArray(offer4addOn.availableAtOrFrom)
|
|
449
|
+
// && offer4addOn.availableAtOrFrom.some(
|
|
450
|
+
// (availableApplication) => availableApplication.id === specifiedStoreId
|
|
451
|
+
// );
|
|
452
|
+
// });
|
|
453
|
+
// }
|
|
412
454
|
// addOnsに対しても有効期間を適用
|
|
413
455
|
if (params.onlyValid === true) {
|
|
414
456
|
offer.addOn = offer.addOn.filter((offer4addOn) => {
|
|
@@ -427,7 +469,7 @@ function searchEventTicketOffers(params) {
|
|
|
427
469
|
}
|
|
428
470
|
}
|
|
429
471
|
}
|
|
430
|
-
return offers;
|
|
472
|
+
return { ticketOffers: offers, unitPriceOffers };
|
|
431
473
|
});
|
|
432
474
|
}
|
|
433
475
|
exports.searchEventTicketOffers = searchEventTicketOffers;
|
|
@@ -114,8 +114,6 @@ function processVoidTransaction4chevre(params) {
|
|
|
114
114
|
transactionNumber: { $eq: transactionNumber }
|
|
115
115
|
});
|
|
116
116
|
if (assetTransactions.length > 0) {
|
|
117
|
-
// 予約取引サービスで中止
|
|
118
|
-
// await repos.reserveTransaction.cancel({ transactionNumber });
|
|
119
117
|
yield ReserveTransactionService.cancel({ transactionNumber })(repos);
|
|
120
118
|
}
|
|
121
119
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
|
+
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
2
3
|
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
3
4
|
export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
4
5
|
acceptedOffers: factory.action.authorize.offer.seatReservation.IAcceptedOffer<factory.service.webAPI.Identifier.COA>[];
|
|
@@ -19,7 +20,7 @@ declare type IResultAcceptedOffer = factory.action.authorize.offer.seatReservati
|
|
|
19
20
|
export declare function responseBody2acceptedOffers4result(params: {
|
|
20
21
|
responseBody: factory.action.authorize.offer.seatReservation.IResponseBody<factory.service.webAPI.Identifier.COA>;
|
|
21
22
|
object: factory.action.authorize.offer.seatReservation.IObject<factory.service.webAPI.Identifier.COA>;
|
|
22
|
-
event:
|
|
23
|
+
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
23
24
|
seller: factory.transaction.placeOrder.ISeller;
|
|
24
25
|
bookingTime: Date;
|
|
25
26
|
totalPrice: number;
|
|
@@ -27,7 +27,11 @@ function authorize(params) {
|
|
|
27
27
|
if (transaction.agent.id !== params.agent.id) {
|
|
28
28
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
31
|
+
// const screeningEvent = await repos.event.findById<factory.eventType.ScreeningEvent>({ id: params.object.event.id });
|
|
32
|
+
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
33
|
+
id: params.object.event.id
|
|
34
|
+
});
|
|
31
35
|
// 必ず定義されている前提
|
|
32
36
|
// const coaInfo = <factory.event.screeningEvent.ICOAInfo>screeningEvent.coaInfo;
|
|
33
37
|
// const acceptedOffersWithoutDetails = await createAcceptedOffersWithoutDetails({
|
|
@@ -158,7 +162,11 @@ function changeOffers(params) {
|
|
|
158
162
|
throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
159
163
|
}
|
|
160
164
|
validate4changeOffer({ action: authorizeAction, object: params.object });
|
|
161
|
-
|
|
165
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
166
|
+
// const screeningEvent = await repos.event.findById<factory.eventType.ScreeningEvent>({ id: params.object.event.id });
|
|
167
|
+
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
168
|
+
id: params.object.event.id
|
|
169
|
+
});
|
|
162
170
|
// COA仮予約後にリクエストが来る前提
|
|
163
171
|
const acceptedOffer = params.object.acceptedOffer;
|
|
164
172
|
// 座席区分加算料金などを補完
|
|
@@ -22,13 +22,20 @@ function mvtkChargePriceSpec2component(params) {
|
|
|
22
22
|
return Object.assign({ id: params.id, typeOf: params.typeOf, name: params.name, price: params.price, priceCurrency: params.priceCurrency, valueAddedTaxIncluded: params.valueAddedTaxIncluded, appliesToVideoFormat: params.appliesToVideoFormat, appliesToMovieTicket: params.appliesToMovieTicket }, (typeof ((_a = params.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { accounting: params.accounting } : undefined);
|
|
23
23
|
}
|
|
24
24
|
function createCompoundPriceSpec4event(params) {
|
|
25
|
+
var _a;
|
|
25
26
|
// priceSpecificationはマスタ管理の仕様上必ず存在するはず
|
|
26
27
|
if (params.offer.priceSpecification === undefined) {
|
|
27
28
|
throw new factory.errors.NotFound(`priceSpecification of the offer: ${params.offer.id}`);
|
|
28
29
|
}
|
|
29
30
|
const unitPriceSpec = Object.assign(Object.assign({}, params.offer.priceSpecification), { name: params.offer.name });
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
let videoFormatChargeSpecComponents = [];
|
|
32
|
+
let soundFormatChargeSpecComponents = [];
|
|
33
|
+
// 区分加算料金を適用しないオプションを追加(2023-01-26~)
|
|
34
|
+
const ignoreCategoryCodeChargeSpec = ((_a = params.offer.settings) === null || _a === void 0 ? void 0 : _a.ignoreCategoryCodeChargeSpec) === true;
|
|
35
|
+
if (!ignoreCategoryCodeChargeSpec) {
|
|
36
|
+
videoFormatChargeSpecComponents = params.videoFormatChargeSpecifications.map(categoryCodeChargePriceSpec2component);
|
|
37
|
+
soundFormatChargeSpecComponents = params.soundFormatChargeSpecifications.map(categoryCodeChargePriceSpec2component);
|
|
38
|
+
}
|
|
32
39
|
const mvtkPriceComponents = [];
|
|
33
40
|
// 複数決済カード対応(2022-07-11~)
|
|
34
41
|
if (Array.isArray(unitPriceSpec.appliesToMovieTicket)) {
|
|
@@ -62,7 +69,7 @@ function createCompoundPriceSpec4event(params) {
|
|
|
62
69
|
priceComponent
|
|
63
70
|
};
|
|
64
71
|
// 不要な属性を除外(2022-11-07~)
|
|
65
|
-
const
|
|
72
|
+
const _b = params.offer, { project } = _b, unitOfferFields4ticketOffer = __rest(_b, ["project"]);
|
|
66
73
|
return Object.assign(Object.assign({}, unitOfferFields4ticketOffer), { eligibleQuantity: params.eligibleQuantity, priceSpecification: compoundPriceSpecification });
|
|
67
74
|
}
|
|
68
75
|
exports.createCompoundPriceSpec4event = createCompoundPriceSpec4event;
|
|
@@ -23,7 +23,7 @@ function searchProductOffers(params) {
|
|
|
23
23
|
if (typeof offerCatalogId !== 'string') {
|
|
24
24
|
return [];
|
|
25
25
|
}
|
|
26
|
-
const offers = yield repos.offer.findOffersByOfferCatalogId({ offerCatalog: { id: offerCatalogId } });
|
|
26
|
+
const offers = yield repos.offer.findOffersByOfferCatalogId({ offerCatalog: { id: offerCatalogId }, sort: params.sort });
|
|
27
27
|
return offers.map((o) => {
|
|
28
28
|
const unitSpec = o.priceSpecification;
|
|
29
29
|
const compoundPriceSpecification = {
|
|
@@ -58,7 +58,10 @@ function search(params) {
|
|
|
58
58
|
return offers;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
offers = yield (0, searchProductOffers_1.searchProductOffers)({
|
|
61
|
+
offers = yield (0, searchProductOffers_1.searchProductOffers)({
|
|
62
|
+
itemOffered: { id: params.itemOffered.id },
|
|
63
|
+
sort: params.sort
|
|
64
|
+
})(repos);
|
|
62
65
|
// 店舗条件によって対象を絞る
|
|
63
66
|
const storeId = (_b = params.availableAt) === null || _b === void 0 ? void 0 : _b.id;
|
|
64
67
|
if (typeof storeId === 'string') {
|
|
@@ -114,6 +117,7 @@ function authorize(params) {
|
|
|
114
117
|
}
|
|
115
118
|
// ポイント特典の識別子に利用するため注文番号を先に発行
|
|
116
119
|
const orderNumber = yield (0, placeOrderInProgress_1.publishOrderNumberIfNotExist)({
|
|
120
|
+
project: { id: transaction.project.id },
|
|
117
121
|
id: transaction.id,
|
|
118
122
|
object: { orderDate: new Date() }
|
|
119
123
|
})(repos);
|
|
@@ -198,7 +202,8 @@ function fixProductAndOffers(params) {
|
|
|
198
202
|
if (product === undefined) {
|
|
199
203
|
throw new factory.errors.NotFound('Product');
|
|
200
204
|
}
|
|
201
|
-
const availableOffers = yield search(Object.assign({ project: { id: params.project.id }, itemOffered: { id: String(product.id) }, onlyValid: true }, (typeof ((_c = params.location) === null || _c === void 0 ? void 0 : _c.id) === 'string') ? { availableAt: { id: params.location.id } } : undefined)
|
|
205
|
+
const availableOffers = yield search(Object.assign(Object.assign({ project: { id: params.project.id }, itemOffered: { id: String(product.id) }, onlyValid: true }, (typeof ((_c = params.location) === null || _c === void 0 ? void 0 : _c.id) === 'string') ? { availableAt: { id: params.location.id } } : undefined), { sort: false // ソート不要(2023-01-27~)
|
|
206
|
+
}))(repos);
|
|
202
207
|
return { product, availableOffers };
|
|
203
208
|
});
|
|
204
209
|
}
|
|
@@ -60,10 +60,20 @@ export declare function searchEventSeatOffersWithPaging(params: {
|
|
|
60
60
|
eventAvailability: EventAvailabilityRepo;
|
|
61
61
|
place: PlaceRepo;
|
|
62
62
|
}) => Promise<factory.place.seat.IPlaceWithOffer[]>;
|
|
63
|
+
interface IChangedEvent {
|
|
64
|
+
id: string;
|
|
65
|
+
typeOf: factory.eventType;
|
|
66
|
+
project: {
|
|
67
|
+
id: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
63
70
|
/**
|
|
64
71
|
* イベント変更時処理
|
|
65
72
|
*/
|
|
66
|
-
export declare function onEventChanged(params:
|
|
73
|
+
export declare function onEventChanged(params: {
|
|
74
|
+
event: IChangedEvent | IChangedEvent[];
|
|
75
|
+
isNew: boolean;
|
|
76
|
+
}): (repos: {
|
|
67
77
|
event: EventRepo;
|
|
68
78
|
project: ProjectRepo;
|
|
69
79
|
task: TaskRepo;
|
|
@@ -74,7 +84,8 @@ export declare function createAggregateScreeningEventIfNotExist(params: {
|
|
|
74
84
|
};
|
|
75
85
|
reservationFor: {
|
|
76
86
|
id: string;
|
|
77
|
-
};
|
|
87
|
+
}[];
|
|
88
|
+
force: boolean;
|
|
78
89
|
}): (repos: {
|
|
79
90
|
task: TaskRepo;
|
|
80
91
|
}) => Promise<void>;
|
|
@@ -69,7 +69,11 @@ function searchEventSeatOffers(params) {
|
|
|
69
69
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
71
71
|
let offers = [];
|
|
72
|
-
|
|
72
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
73
|
+
// const event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>({
|
|
74
|
+
// id: params.event.id
|
|
75
|
+
// });
|
|
76
|
+
const event = yield repos.event.findMinimizedIndividualEventById({
|
|
73
77
|
id: params.event.id
|
|
74
78
|
});
|
|
75
79
|
// 座席指定利用可能かどうか
|
|
@@ -139,7 +143,11 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
139
143
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
140
144
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
141
145
|
let offers = [];
|
|
142
|
-
|
|
146
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
147
|
+
// const event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>({
|
|
148
|
+
// id: params.event.id
|
|
149
|
+
// });
|
|
150
|
+
const event = yield repos.event.findMinimizedIndividualEventById({
|
|
143
151
|
id: params.event.id
|
|
144
152
|
});
|
|
145
153
|
// 座席指定利用可能かどうか
|
|
@@ -204,57 +212,71 @@ exports.searchEventSeatOffersWithPaging = searchEventSeatOffersWithPaging;
|
|
|
204
212
|
*/
|
|
205
213
|
function onEventChanged(params) {
|
|
206
214
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
// numberOfTried: 0,
|
|
221
|
-
// executionResults: [],
|
|
222
|
-
// data: { id: event.id, typeOf: event.typeOf }
|
|
223
|
-
// };
|
|
224
|
-
// await repos.task.save(aggregateTask);
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
// イベント通知タスク
|
|
228
|
-
// const project = await repos.project.findById({ id: event.project.id });
|
|
215
|
+
const changedEvents = (Array.isArray(params.event)) ? params.event : [params.event];
|
|
216
|
+
if (changedEvents.length > 0) {
|
|
217
|
+
// ScreeningEventであれば集計タスク
|
|
218
|
+
if (changedEvents[0].typeOf === factory.eventType.ScreeningEvent) {
|
|
219
|
+
yield createAggregateScreeningEventIfNotExist({
|
|
220
|
+
project: { id: changedEvents[0].project.id },
|
|
221
|
+
reservationFor: changedEvents.map((changedEvent) => {
|
|
222
|
+
return { id: changedEvent.id };
|
|
223
|
+
}),
|
|
224
|
+
// 新規作成の場合は強制的に集計
|
|
225
|
+
force: params.isNew
|
|
226
|
+
})(repos);
|
|
227
|
+
}
|
|
229
228
|
}
|
|
230
229
|
});
|
|
231
230
|
}
|
|
232
231
|
exports.onEventChanged = onEventChanged;
|
|
233
232
|
function createAggregateScreeningEventIfNotExist(params) {
|
|
234
233
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
234
|
+
let aggregateTasks = [];
|
|
235
|
+
const runsAt = new Date();
|
|
236
|
+
const remainingNumberOfTries = 2;
|
|
237
|
+
const project = {
|
|
238
|
+
id: params.project.id, typeOf: factory.organizationType.Project
|
|
239
|
+
};
|
|
240
|
+
if (params.force) {
|
|
241
|
+
aggregateTasks = params.reservationFor.map((reservationFor) => {
|
|
242
|
+
return {
|
|
243
|
+
project,
|
|
244
|
+
name: factory.taskName.AggregateScreeningEvent,
|
|
245
|
+
status: factory.taskStatus.Ready,
|
|
246
|
+
runsAt,
|
|
247
|
+
remainingNumberOfTries,
|
|
248
|
+
numberOfTried: 0,
|
|
249
|
+
executionResults: [],
|
|
250
|
+
data: { typeOf: factory.eventType.ScreeningEvent, id: reservationFor.id }
|
|
251
|
+
};
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
for (const reservationFor of params.reservationFor) {
|
|
256
|
+
// 冗長な作成を避ける
|
|
257
|
+
const readyAggregateScreeningEventTaskDoc = yield repos.task.taskModel.findOne({
|
|
258
|
+
'project.id': { $eq: project.id },
|
|
259
|
+
name: { $eq: factory.taskName.AggregateScreeningEvent },
|
|
260
|
+
status: { $eq: factory.taskStatus.Ready },
|
|
261
|
+
'data.id': { $exists: true, $eq: reservationFor.id }
|
|
262
|
+
}, { _id: 1 })
|
|
263
|
+
.exec();
|
|
264
|
+
if (readyAggregateScreeningEventTaskDoc === null) {
|
|
265
|
+
aggregateTasks.push({
|
|
266
|
+
project,
|
|
267
|
+
name: factory.taskName.AggregateScreeningEvent,
|
|
268
|
+
status: factory.taskStatus.Ready,
|
|
269
|
+
runsAt,
|
|
270
|
+
remainingNumberOfTries,
|
|
271
|
+
numberOfTried: 0,
|
|
272
|
+
executionResults: [],
|
|
273
|
+
data: { typeOf: factory.eventType.ScreeningEvent, id: reservationFor.id }
|
|
274
|
+
});
|
|
255
275
|
}
|
|
256
|
-
}
|
|
257
|
-
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (aggregateTasks.length > 0) {
|
|
279
|
+
yield repos.task.saveMany(aggregateTasks);
|
|
258
280
|
}
|
|
259
281
|
});
|
|
260
282
|
}
|