@chevre/domain 20.4.0-alpha.11 → 20.4.0-alpha.13
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/searchEventTicketOffers.ts +1 -1
- package/example/src/chevre/searchOffersByCatalog.ts +1 -0
- package/lib/chevre/repo/offer.d.ts +1 -0
- package/lib/chevre/repo/offer.js +33 -23
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -0
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +43 -32
- package/lib/chevre/service/offer/factory.js +46 -12
- package/lib/chevre/service/offer/product/searchProductOffers.js +5 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +25 -53
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +3 -1
- package/package.json +2 -2
|
@@ -22,7 +22,7 @@ async function main() {
|
|
|
22
22
|
const productRepo = new chevre.repository.Product(mongoose.connection);
|
|
23
23
|
|
|
24
24
|
const { ticketOffers } = await chevre.service.offer.event.searchEventTicketOffers({
|
|
25
|
-
event: { id: '
|
|
25
|
+
event: { id: 'ale6qiedf' },
|
|
26
26
|
onlyValid: true,
|
|
27
27
|
sort: true,
|
|
28
28
|
validateOfferRateLimit: true
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -35,7 +35,7 @@ class MongoRepository {
|
|
|
35
35
|
}
|
|
36
36
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
37
37
|
static CREATE_OFFER_MONGO_CONDITIONS(params) {
|
|
38
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28;
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31;
|
|
39
39
|
// MongoDB検索条件
|
|
40
40
|
const andConditions = [];
|
|
41
41
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -166,7 +166,15 @@ class MongoRepository {
|
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
const
|
|
169
|
+
const appliesToMovieTicketServiceTypeExist = (_w = (_v = (_u = params.priceSpecification) === null || _u === void 0 ? void 0 : _u.appliesToMovieTicket) === null || _v === void 0 ? void 0 : _v.serviceType) === null || _w === void 0 ? void 0 : _w.$exists;
|
|
170
|
+
if (typeof appliesToMovieTicketServiceTypeExist === 'boolean') {
|
|
171
|
+
andConditions.push({
|
|
172
|
+
'priceSpecification.appliesToMovieTicket.serviceType': {
|
|
173
|
+
$exists: appliesToMovieTicketServiceTypeExist
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
const appliesToMovieTicketServiceTypeEq = (_z = (_y = (_x = params.priceSpecification) === null || _x === void 0 ? void 0 : _x.appliesToMovieTicket) === null || _y === void 0 ? void 0 : _y.serviceType) === null || _z === void 0 ? void 0 : _z.$eq;
|
|
170
178
|
if (typeof appliesToMovieTicketServiceTypeEq === 'string') {
|
|
171
179
|
andConditions.push({
|
|
172
180
|
'priceSpecification.appliesToMovieTicket.serviceType': {
|
|
@@ -175,7 +183,7 @@ class MongoRepository {
|
|
|
175
183
|
}
|
|
176
184
|
});
|
|
177
185
|
}
|
|
178
|
-
const appliesToMovieTicketServiceOutputTypeOfEq = (
|
|
186
|
+
const appliesToMovieTicketServiceOutputTypeOfEq = (_3 = (_2 = (_1 = (_0 = params.priceSpecification) === null || _0 === void 0 ? void 0 : _0.appliesToMovieTicket) === null || _1 === void 0 ? void 0 : _1.serviceOutput) === null || _2 === void 0 ? void 0 : _2.typeOf) === null || _3 === void 0 ? void 0 : _3.$eq;
|
|
179
187
|
if (typeof appliesToMovieTicketServiceOutputTypeOfEq === 'string') {
|
|
180
188
|
andConditions.push({
|
|
181
189
|
'priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': {
|
|
@@ -184,7 +192,7 @@ class MongoRepository {
|
|
|
184
192
|
}
|
|
185
193
|
});
|
|
186
194
|
}
|
|
187
|
-
const appliesToMovieTicketServiceOutputTypeOfNin = (
|
|
195
|
+
const appliesToMovieTicketServiceOutputTypeOfNin = (_7 = (_6 = (_5 = (_4 = params.priceSpecification) === null || _4 === void 0 ? void 0 : _4.appliesToMovieTicket) === null || _5 === void 0 ? void 0 : _5.serviceOutput) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$nin;
|
|
188
196
|
if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfNin)) {
|
|
189
197
|
andConditions.push({
|
|
190
198
|
'priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': {
|
|
@@ -193,7 +201,7 @@ class MongoRepository {
|
|
|
193
201
|
});
|
|
194
202
|
}
|
|
195
203
|
if (params.priceSpecification !== undefined && params.priceSpecification !== null) {
|
|
196
|
-
const priceSpecificationPriceGte = (
|
|
204
|
+
const priceSpecificationPriceGte = (_8 = params.priceSpecification.price) === null || _8 === void 0 ? void 0 : _8.$gte;
|
|
197
205
|
if (typeof priceSpecificationPriceGte === 'number') {
|
|
198
206
|
andConditions.push({
|
|
199
207
|
'priceSpecification.price': {
|
|
@@ -202,7 +210,7 @@ class MongoRepository {
|
|
|
202
210
|
}
|
|
203
211
|
});
|
|
204
212
|
}
|
|
205
|
-
const priceSpecificationPriceLte = (
|
|
213
|
+
const priceSpecificationPriceLte = (_9 = params.priceSpecification.price) === null || _9 === void 0 ? void 0 : _9.$lte;
|
|
206
214
|
if (typeof priceSpecificationPriceLte === 'number') {
|
|
207
215
|
andConditions.push({
|
|
208
216
|
'priceSpecification.price': {
|
|
@@ -211,7 +219,7 @@ class MongoRepository {
|
|
|
211
219
|
}
|
|
212
220
|
});
|
|
213
221
|
}
|
|
214
|
-
const accountsReceivableGte = (
|
|
222
|
+
const accountsReceivableGte = (_11 = (_10 = params.priceSpecification.accounting) === null || _10 === void 0 ? void 0 : _10.accountsReceivable) === null || _11 === void 0 ? void 0 : _11.$gte;
|
|
215
223
|
if (typeof accountsReceivableGte === 'number') {
|
|
216
224
|
andConditions.push({
|
|
217
225
|
'priceSpecification.accounting.accountsReceivable': {
|
|
@@ -220,7 +228,7 @@ class MongoRepository {
|
|
|
220
228
|
}
|
|
221
229
|
});
|
|
222
230
|
}
|
|
223
|
-
const accountsReceivableLte = (
|
|
231
|
+
const accountsReceivableLte = (_13 = (_12 = params.priceSpecification.accounting) === null || _12 === void 0 ? void 0 : _12.accountsReceivable) === null || _13 === void 0 ? void 0 : _13.$lte;
|
|
224
232
|
if (typeof accountsReceivableLte === 'number') {
|
|
225
233
|
andConditions.push({
|
|
226
234
|
'priceSpecification.accounting.accountsReceivable': {
|
|
@@ -229,7 +237,7 @@ class MongoRepository {
|
|
|
229
237
|
}
|
|
230
238
|
});
|
|
231
239
|
}
|
|
232
|
-
const accountingCodeValueEq = (
|
|
240
|
+
const accountingCodeValueEq = (_16 = (_15 = (_14 = params.priceSpecification.accounting) === null || _14 === void 0 ? void 0 : _14.operatingRevenue) === null || _15 === void 0 ? void 0 : _15.codeValue) === null || _16 === void 0 ? void 0 : _16.$eq;
|
|
233
241
|
if (typeof accountingCodeValueEq === 'string') {
|
|
234
242
|
andConditions.push({
|
|
235
243
|
'priceSpecification.accounting.operatingRevenue.codeValue': {
|
|
@@ -238,7 +246,7 @@ class MongoRepository {
|
|
|
238
246
|
}
|
|
239
247
|
});
|
|
240
248
|
}
|
|
241
|
-
const accountingCodeValueIn = (
|
|
249
|
+
const accountingCodeValueIn = (_19 = (_18 = (_17 = params.priceSpecification.accounting) === null || _17 === void 0 ? void 0 : _17.operatingRevenue) === null || _18 === void 0 ? void 0 : _18.codeValue) === null || _19 === void 0 ? void 0 : _19.$in;
|
|
242
250
|
if (Array.isArray(accountingCodeValueIn)) {
|
|
243
251
|
andConditions.push({
|
|
244
252
|
'priceSpecification.accounting.operatingRevenue.codeValue': {
|
|
@@ -247,7 +255,7 @@ class MongoRepository {
|
|
|
247
255
|
}
|
|
248
256
|
});
|
|
249
257
|
}
|
|
250
|
-
const referenceQuantityValueEq = (
|
|
258
|
+
const referenceQuantityValueEq = (_21 = (_20 = params.priceSpecification.referenceQuantity) === null || _20 === void 0 ? void 0 : _20.value) === null || _21 === void 0 ? void 0 : _21.$eq;
|
|
251
259
|
if (typeof referenceQuantityValueEq === 'number') {
|
|
252
260
|
andConditions.push({
|
|
253
261
|
'priceSpecification.referenceQuantity.value': {
|
|
@@ -257,7 +265,7 @@ class MongoRepository {
|
|
|
257
265
|
});
|
|
258
266
|
}
|
|
259
267
|
}
|
|
260
|
-
const availableAtOrFromIdEq = (
|
|
268
|
+
const availableAtOrFromIdEq = (_23 = (_22 = params.availableAtOrFrom) === null || _22 === void 0 ? void 0 : _22.id) === null || _23 === void 0 ? void 0 : _23.$eq;
|
|
261
269
|
if (typeof availableAtOrFromIdEq === 'string') {
|
|
262
270
|
andConditions.push({
|
|
263
271
|
'availableAtOrFrom.id': {
|
|
@@ -266,7 +274,7 @@ class MongoRepository {
|
|
|
266
274
|
}
|
|
267
275
|
});
|
|
268
276
|
}
|
|
269
|
-
const availableAtOrFromIdIn = (
|
|
277
|
+
const availableAtOrFromIdIn = (_25 = (_24 = params.availableAtOrFrom) === null || _24 === void 0 ? void 0 : _24.id) === null || _25 === void 0 ? void 0 : _25.$in;
|
|
270
278
|
if (Array.isArray(availableAtOrFromIdIn)) {
|
|
271
279
|
andConditions.push({
|
|
272
280
|
'availableAtOrFrom.id': {
|
|
@@ -275,7 +283,7 @@ class MongoRepository {
|
|
|
275
283
|
}
|
|
276
284
|
});
|
|
277
285
|
}
|
|
278
|
-
const addOnItemOfferedIdEq = (
|
|
286
|
+
const addOnItemOfferedIdEq = (_28 = (_27 = (_26 = params.addOn) === null || _26 === void 0 ? void 0 : _26.itemOffered) === null || _27 === void 0 ? void 0 : _27.id) === null || _28 === void 0 ? void 0 : _28.$eq;
|
|
279
287
|
if (typeof addOnItemOfferedIdEq === 'string') {
|
|
280
288
|
andConditions.push({
|
|
281
289
|
'addOn.itemOffered.id': {
|
|
@@ -284,7 +292,7 @@ class MongoRepository {
|
|
|
284
292
|
}
|
|
285
293
|
});
|
|
286
294
|
}
|
|
287
|
-
const hasMerchantReturnPolicyIdEq = (
|
|
295
|
+
const hasMerchantReturnPolicyIdEq = (_30 = (_29 = params.hasMerchantReturnPolicy) === null || _29 === void 0 ? void 0 : _29.id) === null || _30 === void 0 ? void 0 : _30.$eq;
|
|
288
296
|
if (typeof hasMerchantReturnPolicyIdEq === 'string') {
|
|
289
297
|
andConditions.push({
|
|
290
298
|
'hasMerchantReturnPolicy.id': {
|
|
@@ -293,7 +301,7 @@ class MongoRepository {
|
|
|
293
301
|
}
|
|
294
302
|
});
|
|
295
303
|
}
|
|
296
|
-
const additionalPropertyElemMatch = (
|
|
304
|
+
const additionalPropertyElemMatch = (_31 = params.additionalProperty) === null || _31 === void 0 ? void 0 : _31.$elemMatch;
|
|
297
305
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
298
306
|
andConditions.push({
|
|
299
307
|
additionalProperty: {
|
|
@@ -336,17 +344,19 @@ class MongoRepository {
|
|
|
336
344
|
if (sortedOfferIds.length > 0) {
|
|
337
345
|
const searchOffersConditions = Object.assign(Object.assign({ id: { $in: sortedOfferIds } }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
338
346
|
? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } }
|
|
339
|
-
: undefined),
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
appliesToMovieTicket: {
|
|
347
|
+
: undefined), { priceSpecification: {
|
|
348
|
+
appliesToMovieTicket: Object.assign(Object.assign({}, (Array.isArray(params.unacceptedPaymentMethod) && params.unacceptedPaymentMethod.length > 0)
|
|
349
|
+
? {
|
|
343
350
|
serviceOutput: {
|
|
344
351
|
typeOf: { $nin: params.unacceptedPaymentMethod }
|
|
345
352
|
}
|
|
346
353
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
354
|
+
: undefined), (params.excludeAppliesToMovieTicket)
|
|
355
|
+
? {
|
|
356
|
+
serviceType: { $exists: false }
|
|
357
|
+
}
|
|
358
|
+
: undefined)
|
|
359
|
+
} });
|
|
350
360
|
offers = yield this.search(searchOffersConditions);
|
|
351
361
|
if (params.sort) {
|
|
352
362
|
// sorting
|
|
@@ -210,6 +210,7 @@ function findOffers(params) {
|
|
|
210
210
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
211
211
|
availableOffers = yield repos.offer.findOffersByOfferCatalogId({
|
|
212
212
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
213
|
+
excludeAppliesToMovieTicket: false,
|
|
213
214
|
sort: false // ソート不要(2023-01-27~)
|
|
214
215
|
});
|
|
215
216
|
}
|
|
@@ -93,6 +93,7 @@ function findOffers(params) {
|
|
|
93
93
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
94
94
|
availableOffers = yield repos.offer.findOffersByOfferCatalogId({
|
|
95
95
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
96
|
+
excludeAppliesToMovieTicket: false,
|
|
96
97
|
sort: false // ソート不要(2023-01-27~)
|
|
97
98
|
});
|
|
98
99
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.searchEventTicketOffers = void 0;
|
|
13
13
|
const moment = require("moment-timezone");
|
|
14
14
|
const factory = require("../../../factory");
|
|
15
|
+
const settings_1 = require("../../../settings");
|
|
15
16
|
const factory_1 = require("../factory");
|
|
16
17
|
/**
|
|
17
18
|
* 旅客オファー検索
|
|
@@ -24,6 +25,8 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
24
25
|
const soundFormatTypes = [];
|
|
25
26
|
const videoFormatTypes = [];
|
|
26
27
|
const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event: screeningEvent });
|
|
28
|
+
// 上映方式がなければMovieTicket除外(2023-02-21~)
|
|
29
|
+
const excludeAppliesToMovieTicket = videoFormatTypes.length === 0;
|
|
27
30
|
let availableOffers = [];
|
|
28
31
|
// 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
29
32
|
const eventOffers = screeningEvent.offers;
|
|
@@ -35,6 +38,7 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
35
38
|
offerCatalog: { id: transportation.hasOfferCatalog.id },
|
|
36
39
|
availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id },
|
|
37
40
|
unacceptedPaymentMethod,
|
|
41
|
+
excludeAppliesToMovieTicket,
|
|
38
42
|
sort: params.sort
|
|
39
43
|
});
|
|
40
44
|
}
|
|
@@ -55,9 +59,9 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
55
59
|
return false;
|
|
56
60
|
}
|
|
57
61
|
// 上映方式がなければ除外(2022-11-03~)
|
|
58
|
-
if (videoFormatTypes.length === 0) {
|
|
59
|
-
|
|
60
|
-
}
|
|
62
|
+
// if (videoFormatTypes.length === 0) {
|
|
63
|
+
// return false;
|
|
64
|
+
// }
|
|
61
65
|
return priceSpecificationAppliesToMovieTicket.every((appliesToMovieTicket) => {
|
|
62
66
|
// すべての上映方式について検証する(2022-10-29~)
|
|
63
67
|
return videoFormatTypes.every((videoFormat) => {
|
|
@@ -134,6 +138,8 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
134
138
|
const soundFormatTypes = (Array.isArray(superEvent.soundFormat)) ? superEvent.soundFormat.map((f) => f.typeOf) : [];
|
|
135
139
|
const videoFormatTypes = (Array.isArray(superEvent.videoFormat)) ? superEvent.videoFormat.map((f) => f.typeOf) : [];
|
|
136
140
|
const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event: screeningEvent });
|
|
141
|
+
// 上映方式がなければMovieTicket除外(2023-02-21~)
|
|
142
|
+
const excludeAppliesToMovieTicket = videoFormatTypes.length === 0;
|
|
137
143
|
let availableOffers = [];
|
|
138
144
|
// 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
139
145
|
const eventOffers = screeningEvent.offers;
|
|
@@ -145,6 +151,7 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
145
151
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
146
152
|
availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id },
|
|
147
153
|
unacceptedPaymentMethod,
|
|
154
|
+
excludeAppliesToMovieTicket,
|
|
148
155
|
sort: params.sort
|
|
149
156
|
});
|
|
150
157
|
}
|
|
@@ -170,37 +177,40 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
170
177
|
// }
|
|
171
178
|
// });
|
|
172
179
|
// }
|
|
173
|
-
//
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (priceSpecificationAppliesToMovieTicket
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
//
|
|
189
|
-
return
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return ((
|
|
193
|
-
|
|
194
|
-
|
|
180
|
+
// 決済カード加算料金が存在しない場合自動補完する(2023-02-21~)
|
|
181
|
+
if (!settings_1.settings.useOffersAppliedToMovieTicketWithoutChargeSpecification) {
|
|
182
|
+
// 適用決済カード条件がある場合、決済カード加算料金が存在しないオファーは除外する
|
|
183
|
+
availableOffers = availableOffers.filter((o) => {
|
|
184
|
+
var _a;
|
|
185
|
+
// 複数決済カード対応(2022-07-26~)
|
|
186
|
+
const priceSpecificationAppliesToMovieTicket = (_a = o.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket;
|
|
187
|
+
if (Array.isArray(priceSpecificationAppliesToMovieTicket)) {
|
|
188
|
+
// 適用決済カード数が0であれば除外
|
|
189
|
+
if (priceSpecificationAppliesToMovieTicket.length === 0) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
// 上映方式がなければ除外(2022-11-03~)
|
|
193
|
+
// if (videoFormatTypes.length === 0) {
|
|
194
|
+
// return false;
|
|
195
|
+
// }
|
|
196
|
+
return priceSpecificationAppliesToMovieTicket.every((appliesToMovieTicket) => {
|
|
197
|
+
// すべての上映方式について検証する(2022-10-29~)
|
|
198
|
+
return videoFormatTypes.every((videoFormat) => {
|
|
199
|
+
return movieTicketTypeChargeSpecs.some((s) => {
|
|
200
|
+
var _a, _b, _c, _d;
|
|
201
|
+
return ((_b = (_a = s.appliesToMovieTicket) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.typeOf) === ((_c = appliesToMovieTicket.serviceOutput) === null || _c === void 0 ? void 0 : _c.typeOf)
|
|
202
|
+
&& ((_d = s.appliesToMovieTicket) === null || _d === void 0 ? void 0 : _d.serviceType) === appliesToMovieTicket.serviceType
|
|
203
|
+
&& s.appliesToVideoFormat === videoFormat;
|
|
204
|
+
});
|
|
195
205
|
});
|
|
196
206
|
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
// Arrayでないケースは廃止(2022-09-10~)
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
204
214
|
// paging処理を追加(2023-02-21~)
|
|
205
215
|
if (typeof params.limit === 'number' && typeof params.page === 'number') {
|
|
206
216
|
const start = params.limit * (params.page - 1);
|
|
@@ -337,6 +347,7 @@ function searchAddOns(params) {
|
|
|
337
347
|
offers = yield repos.offer.findOffersByOfferCatalogId({
|
|
338
348
|
offerCatalog: { id: offerCatalogId },
|
|
339
349
|
availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id },
|
|
350
|
+
excludeAppliesToMovieTicket: false,
|
|
340
351
|
sort: true
|
|
341
352
|
});
|
|
342
353
|
offers = offers.map((o) => {
|
|
@@ -13,6 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.createCompoundPriceSpec4event = void 0;
|
|
15
15
|
const factory = require("../../factory");
|
|
16
|
+
const settings_1 = require("../../settings");
|
|
16
17
|
function categoryCodeChargePriceSpec2component(params) {
|
|
17
18
|
var _a;
|
|
18
19
|
return Object.assign({ id: params.id, typeOf: params.typeOf, name: params.name, price: params.price, priceCurrency: params.priceCurrency, valueAddedTaxIncluded: params.valueAddedTaxIncluded, appliesToCategoryCode: params.appliesToCategoryCode }, (typeof ((_a = params.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { accounting: params.accounting } : undefined);
|
|
@@ -21,6 +22,7 @@ function mvtkChargePriceSpec2component(params) {
|
|
|
21
22
|
var _a;
|
|
22
23
|
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
24
|
}
|
|
25
|
+
// tslint:disable-next-line:max-func-body-length
|
|
24
26
|
function createCompoundPriceSpec4event(params) {
|
|
25
27
|
var _a;
|
|
26
28
|
// priceSpecificationはマスタ管理の仕様上必ず存在するはず
|
|
@@ -39,19 +41,51 @@ function createCompoundPriceSpec4event(params) {
|
|
|
39
41
|
const mvtkPriceComponents = [];
|
|
40
42
|
// 複数決済カード対応(2022-07-11~)
|
|
41
43
|
if (Array.isArray(unitPriceSpec.appliesToMovieTicket)) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
// 決済カード加算料金自動補完(2023-02-21~)
|
|
45
|
+
if (settings_1.settings.useOffersAppliedToMovieTicketWithoutChargeSpecification) {
|
|
46
|
+
unitPriceSpec.appliesToMovieTicket.forEach((appliesToMovieTicket) => {
|
|
47
|
+
// すべての上映方式に該当する加算料金を追加
|
|
48
|
+
params.videoFormatTypes.forEach((videoFormatType) => {
|
|
49
|
+
let existingMvtkSpec4appliesToMovieTicket = params.movieTicketTypeChargeSpecs.find((s) => {
|
|
50
|
+
var _a;
|
|
51
|
+
return ((_a = s.appliesToMovieTicket.serviceOutput) === null || _a === void 0 ? void 0 : _a.typeOf) === appliesToMovieTicket.serviceOutput.typeOf
|
|
52
|
+
&& s.appliesToMovieTicket.serviceType === appliesToMovieTicket.serviceType
|
|
53
|
+
&& s.appliesToVideoFormat === videoFormatType;
|
|
54
|
+
});
|
|
55
|
+
// 加算料金が存在しなければprice: 0で自動補完
|
|
56
|
+
if (existingMvtkSpec4appliesToMovieTicket === undefined) {
|
|
57
|
+
existingMvtkSpec4appliesToMovieTicket = {
|
|
58
|
+
typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification,
|
|
59
|
+
price: 0,
|
|
60
|
+
priceCurrency: factory.priceCurrency.JPY,
|
|
61
|
+
appliesToVideoFormat: videoFormatType,
|
|
62
|
+
valueAddedTaxIncluded: true,
|
|
63
|
+
project: params.offer.project,
|
|
64
|
+
id: '',
|
|
65
|
+
name: params.offer.name,
|
|
66
|
+
appliesToMovieTicket: {
|
|
67
|
+
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
68
|
+
serviceType: appliesToMovieTicket.serviceType,
|
|
69
|
+
serviceOutput: { typeOf: appliesToMovieTicket.serviceOutput.typeOf }
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
mvtkPriceComponents.push(mvtkChargePriceSpec2component(existingMvtkSpec4appliesToMovieTicket));
|
|
74
|
+
});
|
|
49
75
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
unitPriceSpec.appliesToMovieTicket.forEach((appliesToMovieTicket) => {
|
|
79
|
+
// すべての上映方式に該当する加算料金を追加(2022-10-29~)
|
|
80
|
+
const mvtkSpecs4appliesToMovieTicket = params.movieTicketTypeChargeSpecs.filter((s) => {
|
|
81
|
+
var _a;
|
|
82
|
+
return ((_a = s.appliesToMovieTicket.serviceOutput) === null || _a === void 0 ? void 0 : _a.typeOf) === appliesToMovieTicket.serviceOutput.typeOf
|
|
83
|
+
&& s.appliesToMovieTicket.serviceType === appliesToMovieTicket.serviceType
|
|
84
|
+
&& params.videoFormatTypes.includes(s.appliesToVideoFormat);
|
|
85
|
+
});
|
|
86
|
+
mvtkPriceComponents.push(...mvtkSpecs4appliesToMovieTicket.map(mvtkChargePriceSpec2component));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
55
89
|
}
|
|
56
90
|
// 区分加算料金は決済カード適用でも価格要素に含まれるはず(2022-11-02~)
|
|
57
91
|
const priceComponent = [
|
|
@@ -23,7 +23,11 @@ function searchProductOffers(params) {
|
|
|
23
23
|
if (typeof offerCatalogId !== 'string') {
|
|
24
24
|
return [];
|
|
25
25
|
}
|
|
26
|
-
const offers = yield repos.offer.findOffersByOfferCatalogId({
|
|
26
|
+
const offers = yield repos.offer.findOffersByOfferCatalogId({
|
|
27
|
+
offerCatalog: { id: offerCatalogId },
|
|
28
|
+
excludeAppliesToMovieTicket: false,
|
|
29
|
+
sort: params.sort
|
|
30
|
+
});
|
|
27
31
|
return offers.map((o) => {
|
|
28
32
|
const unitSpec = o.priceSpecification;
|
|
29
33
|
const compoundPriceSpecification = {
|
|
@@ -28,37 +28,6 @@ function onReservationUsed(action, attendedReservation) {
|
|
|
28
28
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
29
29
|
const tasks = [];
|
|
30
30
|
const now = new Date();
|
|
31
|
-
// INFORM_USE_RESERVATION_URL廃止(2023-01-30~)
|
|
32
|
-
// アクション通知タスク作成
|
|
33
|
-
// if (Array.isArray(informUseReservations)) {
|
|
34
|
-
// informUseReservations.filter((informUseReservation) => {
|
|
35
|
-
// return typeof informUseReservation.recipient?.url === 'string'
|
|
36
|
-
// && informUseReservation.recipient.url.length > 0;
|
|
37
|
-
// })
|
|
38
|
-
// .forEach((informUseReservation) => {
|
|
39
|
-
// const triggerWebhookTask: factory.task.triggerWebhook.IAttributes = {
|
|
40
|
-
// project: action.project,
|
|
41
|
-
// name: factory.taskName.TriggerWebhook,
|
|
42
|
-
// status: factory.taskStatus.Ready,
|
|
43
|
-
// runsAt: now,
|
|
44
|
-
// remainingNumberOfTries: 3,
|
|
45
|
-
// numberOfTried: 0,
|
|
46
|
-
// executionResults: [],
|
|
47
|
-
// data: {
|
|
48
|
-
// project: action.project,
|
|
49
|
-
// typeOf: factory.actionType.InformAction,
|
|
50
|
-
// agent: action.project,
|
|
51
|
-
// recipient: {
|
|
52
|
-
// typeOf: factory.personType.Person,
|
|
53
|
-
// id: String(informUseReservation.recipient?.url),
|
|
54
|
-
// url: String(informUseReservation.recipient?.url)
|
|
55
|
-
// },
|
|
56
|
-
// object: action
|
|
57
|
-
// }
|
|
58
|
-
// };
|
|
59
|
-
// tasks.push(triggerWebhookTask);
|
|
60
|
-
// });
|
|
61
|
-
// }
|
|
62
31
|
// inform galobally
|
|
63
32
|
if (Array.isArray(informReservations)) {
|
|
64
33
|
// やや遅延させる(確定通知が未達の可能性を考慮して)
|
|
@@ -100,29 +69,32 @@ function onReservationUsed(action, attendedReservation) {
|
|
|
100
69
|
};
|
|
101
70
|
}));
|
|
102
71
|
}
|
|
72
|
+
// projectを限定する(2023-02-21~)
|
|
103
73
|
// 使用アクション集計タスクを作成する(冗長な作成を避ける)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
74
|
+
if (settings_1.settings.useAggregateEntranceGateProjects.includes(action.project.id)) {
|
|
75
|
+
const readyAggregateUseActionsTaskDoc = yield repos.task.taskModel.findOne({
|
|
76
|
+
'project.id': { $eq: action.project.id },
|
|
77
|
+
name: { $eq: factory.taskName.AggregateUseActionsOnEvent },
|
|
78
|
+
status: { $eq: factory.taskStatus.Ready },
|
|
79
|
+
'data.id': { $exists: true, $eq: attendedReservation.reservationFor.id }
|
|
80
|
+
}, { _id: 1 })
|
|
81
|
+
.exec();
|
|
82
|
+
if (readyAggregateUseActionsTaskDoc === null) {
|
|
83
|
+
const aggregateUseActionsTask = {
|
|
84
|
+
project: attendedReservation.project,
|
|
85
|
+
name: factory.taskName.AggregateUseActionsOnEvent,
|
|
86
|
+
status: factory.taskStatus.Ready,
|
|
87
|
+
runsAt: now,
|
|
88
|
+
remainingNumberOfTries: 3,
|
|
89
|
+
numberOfTried: 0,
|
|
90
|
+
executionResults: [],
|
|
91
|
+
data: {
|
|
92
|
+
typeOf: attendedReservation.reservationFor.typeOf,
|
|
93
|
+
id: attendedReservation.reservationFor.id
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
tasks.push(aggregateUseActionsTask);
|
|
97
|
+
}
|
|
126
98
|
}
|
|
127
99
|
if (tasks.length > 0) {
|
|
128
100
|
yield repos.task.saveMany(tasks);
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export declare type ISettings = factory.project.ISettings & {
|
|
|
22
22
|
userPoolIdNew: string;
|
|
23
23
|
maxNumCreditCardPaymentMethod?: number;
|
|
24
24
|
useEventWorkPerformed: boolean;
|
|
25
|
+
useOffersAppliedToMovieTicketWithoutChargeSpecification: boolean;
|
|
26
|
+
useAggregateEntranceGateProjects: string[];
|
|
25
27
|
};
|
|
26
28
|
export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
|
|
27
29
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
package/lib/chevre/settings.js
CHANGED
|
@@ -94,4 +94,6 @@ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onOrder
|
|
|
94
94
|
timeout: triggerWebhookTimeout
|
|
95
95
|
}, maximumReservationGracePeriodInDays: MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS, userPoolIdOld: String(process.env.USERPOOL_ID_OLD), userPoolIdNew: String(process.env.USERPOOL_ID_NEW) }, (typeof MAX_NUM_CREDIT_CARD_PAYMENT_METHOD === 'number')
|
|
96
96
|
? { maxNumCreditCardPaymentMethod: MAX_NUM_CREDIT_CARD_PAYMENT_METHOD }
|
|
97
|
-
: undefined), { useEventWorkPerformed: process.env.USE_EVENT_WORK_PERFORMED === '1'
|
|
97
|
+
: undefined), { useEventWorkPerformed: process.env.USE_EVENT_WORK_PERFORMED === '1', useOffersAppliedToMovieTicketWithoutChargeSpecification: process.env.USE_OFFERS_APPLIED_TO_MOVIE_TICKET_WITHOUT_PRICE_SPEC === '1', useAggregateEntranceGateProjects: (typeof process.env.USE_AGGREGATE_ENTRANCE_GATE_PROJECTS === 'string')
|
|
98
|
+
? process.env.USE_AGGREGATE_ENTRANCE_GATE_PROJECTS.split(',')
|
|
99
|
+
: [] });
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.289.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.289.0-alpha.11",
|
|
13
13
|
"@cinerino/sdk": "3.140.0-alpha.11",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "20.4.0-alpha.
|
|
123
|
+
"version": "20.4.0-alpha.13"
|
|
124
124
|
}
|