@chevre/domain 20.4.0-alpha.35 → 20.4.0-alpha.37
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 +2 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +63 -29
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -3
- package/lib/chevre/service/payment/movieTicket.js +22 -20
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -0
- package/package.json +3 -3
|
@@ -16,11 +16,12 @@ async function main() {
|
|
|
16
16
|
|
|
17
17
|
// const now = new Date();
|
|
18
18
|
await chevre.service.aggregation.event.aggregateScreeningEvent({
|
|
19
|
-
id:
|
|
19
|
+
id: String(process.env.EVENT_ID)
|
|
20
20
|
})({
|
|
21
21
|
event: new chevre.repository.Event(mongoose.connection),
|
|
22
22
|
eventAvailability: new chevre.repository.itemAvailability.ScreeningEvent(client),
|
|
23
23
|
offer: new chevre.repository.Offer(mongoose.connection),
|
|
24
|
+
offerCatalog: new chevre.repository.OfferCatalog(mongoose.connection),
|
|
24
25
|
offerRateLimit: new chevre.repository.rateLimit.Offer(client),
|
|
25
26
|
place: new chevre.repository.Place(mongoose.connection),
|
|
26
27
|
product: new chevre.repository.Product(mongoose.connection),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MongoRepository as EventRepo } from '../../../repo/event';
|
|
2
2
|
import { RedisRepository as EventAvailabilityRepo } from '../../../repo/itemAvailability/screeningEvent';
|
|
3
3
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
4
|
+
import { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
4
5
|
import { MongoRepository as PlaceRepo } from '../../../repo/place';
|
|
5
6
|
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
6
7
|
import { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
@@ -12,6 +13,7 @@ export declare type IAggregateScreeningEventOperation<T> = (repos: {
|
|
|
12
13
|
event: EventRepo;
|
|
13
14
|
eventAvailability: EventAvailabilityRepo;
|
|
14
15
|
offer: OfferRepo;
|
|
16
|
+
offerCatalog: OfferCatalogRepo;
|
|
15
17
|
offerRateLimit: OfferRateLimitRepo;
|
|
16
18
|
place: PlaceRepo;
|
|
17
19
|
product: ProductRepo;
|
|
@@ -89,18 +89,15 @@ function aggregateByEvent(params) {
|
|
|
89
89
|
event: event,
|
|
90
90
|
screeningRoom: screeningRoom
|
|
91
91
|
})(repos);
|
|
92
|
-
// プロジェクト限定(2023-02-22~)
|
|
93
92
|
// オファーごとの集計
|
|
94
93
|
let aggregateOffer;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
debug('offers aggregated', aggregateOffer);
|
|
103
|
-
}
|
|
94
|
+
aggregateOffer = yield aggregateOfferByEvent({
|
|
95
|
+
aggregateDate: now,
|
|
96
|
+
event: Object.assign(Object.assign({}, event), { maximumAttendeeCapacity,
|
|
97
|
+
remainingAttendeeCapacity }),
|
|
98
|
+
screeningRoom: screeningRoom
|
|
99
|
+
})(repos);
|
|
100
|
+
debug('offers aggregated', aggregateOffer);
|
|
104
101
|
// 値がundefinedの場合に更新しないように注意
|
|
105
102
|
const update = {
|
|
106
103
|
$set: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
|
|
@@ -133,26 +130,36 @@ function reservedSeatsAvailable(params) {
|
|
|
133
130
|
function aggregateOfferByEvent(params) {
|
|
134
131
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
135
132
|
var _a, _b, _c;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
133
|
+
// プロジェクト限定(2023-02-22~)
|
|
134
|
+
if (settings_1.settings.useAggregateOfferProjects.includes(params.event.project.id)) {
|
|
135
|
+
const availableOffers = yield findOffers(params)(repos);
|
|
136
|
+
// オファーごとの予約集計
|
|
137
|
+
const offersWithAggregateReservation = [];
|
|
138
|
+
for (const o of availableOffers) {
|
|
139
|
+
const { maximumAttendeeCapacity, remainingAttendeeCapacity, aggregateReservation } = yield aggregateReservationByOffer({
|
|
140
|
+
aggregateDate: params.aggregateDate,
|
|
141
|
+
event: params.event,
|
|
142
|
+
screeningRoom: params.screeningRoom,
|
|
143
|
+
offer: o
|
|
144
|
+
})(repos);
|
|
145
|
+
offersWithAggregateReservation.push(Object.assign(Object.assign(Object.assign({ typeOf: o.typeOf, id: o.id, identifier: o.identifier, aggregateReservation: aggregateReservation, name: {
|
|
146
|
+
en: (_a = o.name) === null || _a === void 0 ? void 0 : _a.en,
|
|
147
|
+
ja: (_b = o.name) === null || _b === void 0 ? void 0 : _b.ja
|
|
148
|
+
} }, (typeof maximumAttendeeCapacity === 'number') ? { maximumAttendeeCapacity } : undefined), (typeof remainingAttendeeCapacity === 'number') ? { remainingAttendeeCapacity } : undefined), (typeof ((_c = o.category) === null || _c === void 0 ? void 0 : _c.codeValue) === 'string') ? { category: o.category } : undefined));
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
typeOf: factory.offerType.AggregateOffer,
|
|
152
|
+
offerCount: availableOffers.length,
|
|
153
|
+
offers: offersWithAggregateReservation
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const { offerCount } = yield calculateOfferCount({ event: params.event })(repos);
|
|
158
|
+
return {
|
|
159
|
+
typeOf: factory.offerType.AggregateOffer,
|
|
160
|
+
offerCount
|
|
161
|
+
};
|
|
150
162
|
}
|
|
151
|
-
return {
|
|
152
|
-
typeOf: factory.offerType.AggregateOffer,
|
|
153
|
-
offerCount: availableOffers.length,
|
|
154
|
-
offers: offersWithAggregateReservation
|
|
155
|
-
};
|
|
156
163
|
});
|
|
157
164
|
}
|
|
158
165
|
/**
|
|
@@ -194,6 +201,33 @@ function findOffers(params) {
|
|
|
194
201
|
return availableOffers;
|
|
195
202
|
});
|
|
196
203
|
}
|
|
204
|
+
function calculateOfferCount(params) {
|
|
205
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
var _a, _b, _c;
|
|
207
|
+
let offerCount = 0;
|
|
208
|
+
try {
|
|
209
|
+
const eventOffers = params.event.offers;
|
|
210
|
+
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
211
|
+
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
212
|
+
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
213
|
+
const catalogs = yield repos.offerCatalog.search({
|
|
214
|
+
limit: 1,
|
|
215
|
+
page: 1,
|
|
216
|
+
id: { $in: [eventService.hasOfferCatalog.id] }
|
|
217
|
+
});
|
|
218
|
+
const numberOfItems = (_c = catalogs.shift()) === null || _c === void 0 ? void 0 : _c.numberOfItems;
|
|
219
|
+
if (typeof numberOfItems === 'number') {
|
|
220
|
+
offerCount = numberOfItems;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
228
|
+
return { offerCount };
|
|
229
|
+
});
|
|
230
|
+
}
|
|
197
231
|
function aggregateReservationByOffer(params) {
|
|
198
232
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
199
233
|
let reservationCount4offer;
|
|
@@ -3,7 +3,7 @@ import * as factory from '../../../factory';
|
|
|
3
3
|
export declare function createSeatInfoSyncIn(params: {
|
|
4
4
|
paymentMethodType: string;
|
|
5
5
|
paymentMethodId: string;
|
|
6
|
-
movieTickets: factory.
|
|
6
|
+
movieTickets: factory.action.trade.pay.IMovieTicket[];
|
|
7
7
|
event: factory.event.screeningEvent.IEvent;
|
|
8
8
|
purpose: factory.action.trade.pay.IPurpose;
|
|
9
9
|
seller: factory.seller.ISeller;
|
|
@@ -6,11 +6,10 @@ import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
|
6
6
|
import { MongoRepository as SellerRepo } from '../../repo/seller';
|
|
7
7
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
8
8
|
import * as factory from '../../factory';
|
|
9
|
-
declare type IMovieTicket = factory.paymentMethod.paymentCard.movieTicket.IMovieTicket;
|
|
10
9
|
interface ICheckResult {
|
|
11
10
|
purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
|
|
12
11
|
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
13
|
-
movieTickets: IMovieTicket[];
|
|
12
|
+
movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
|
|
14
13
|
}
|
|
15
14
|
interface ICheckOperationRepos {
|
|
16
15
|
action: ActionRepo;
|
|
@@ -48,7 +47,7 @@ declare function checkMovieTicket(params: factory.action.check.paymentMethod.mov
|
|
|
48
47
|
* MovieTicket認証
|
|
49
48
|
*/
|
|
50
49
|
declare function checkByIdentifier(params: {
|
|
51
|
-
movieTickets: IMovieTicket[];
|
|
50
|
+
movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
|
|
52
51
|
seller: factory.seller.ISeller;
|
|
53
52
|
screeningEvent: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
54
53
|
paymentServiceId: string;
|
|
@@ -195,7 +195,7 @@ function purchaseNumberAuthResult2movieTickets(params) {
|
|
|
195
195
|
// tslint:disable-next-line:prefer-array-literal
|
|
196
196
|
[...Array(Number(ykknInfo.ykknKnshbtsmiNum))].forEach(() => {
|
|
197
197
|
movieTickets.push({
|
|
198
|
-
project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
|
|
198
|
+
// project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
|
|
199
199
|
typeOf: paymentMethodType,
|
|
200
200
|
identifier: knyknrNoInfo.knyknrNo,
|
|
201
201
|
accessCode: knyknrNoInfo.pinCd,
|
|
@@ -207,16 +207,16 @@ function purchaseNumberAuthResult2movieTickets(params) {
|
|
|
207
207
|
reservationFor: {
|
|
208
208
|
typeOf: params.screeningEvent.typeOf,
|
|
209
209
|
id: params.screeningEvent.id
|
|
210
|
-
},
|
|
211
|
-
reservedTicket: {
|
|
212
|
-
ticketedSeat: {
|
|
213
|
-
typeOf: factory.placeType.Seat,
|
|
214
|
-
// seatingType: 'Default', // 情報空でよし
|
|
215
|
-
seatNumber: '',
|
|
216
|
-
seatRow: '',
|
|
217
|
-
seatSection: '' // 情報空でよし
|
|
218
|
-
}
|
|
219
210
|
}
|
|
211
|
+
// reservedTicket: {
|
|
212
|
+
// ticketedSeat: {
|
|
213
|
+
// typeOf: factory.placeType.Seat,
|
|
214
|
+
// // seatingType: 'Default', // 情報空でよし
|
|
215
|
+
// seatNumber: '', // 情報空でよし
|
|
216
|
+
// seatRow: '', // 情報空でよし
|
|
217
|
+
// seatSection: '' // 情報空でよし
|
|
218
|
+
// }
|
|
219
|
+
// }
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
});
|
|
@@ -226,7 +226,9 @@ function purchaseNumberAuthResult2movieTickets(params) {
|
|
|
226
226
|
knyknrNoInfoOut.mkknInfo.forEach((mkknInfo) => {
|
|
227
227
|
// tslint:disable-next-line:prefer-array-literal
|
|
228
228
|
[...Array(Number(mkknInfo.mkknKnshbtsmiNum))].forEach(() => {
|
|
229
|
-
movieTickets.push(Object.assign({
|
|
229
|
+
movieTickets.push(Object.assign({
|
|
230
|
+
// project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
|
|
231
|
+
typeOf: paymentMethodType, identifier: knyknrNoInfo.knyknrNo, accessCode: knyknrNoInfo.pinCd, category: {
|
|
230
232
|
codeValue: movieTicketCategoryCode // 追加(2023-02-08~)
|
|
231
233
|
}, amount: {
|
|
232
234
|
typeOf: 'MonetaryAmount',
|
|
@@ -237,16 +239,16 @@ function purchaseNumberAuthResult2movieTickets(params) {
|
|
|
237
239
|
reservationFor: {
|
|
238
240
|
typeOf: params.screeningEvent.typeOf,
|
|
239
241
|
id: params.screeningEvent.id
|
|
240
|
-
},
|
|
241
|
-
reservedTicket: {
|
|
242
|
-
ticketedSeat: {
|
|
243
|
-
typeOf: factory.placeType.Seat,
|
|
244
|
-
// seatingType: 'Default', // 情報空でよし
|
|
245
|
-
seatNumber: '',
|
|
246
|
-
seatRow: '',
|
|
247
|
-
seatSection: '' // 情報空でよし
|
|
248
|
-
}
|
|
249
242
|
}
|
|
243
|
+
// reservedTicket: {
|
|
244
|
+
// ticketedSeat: {
|
|
245
|
+
// typeOf: factory.placeType.Seat,
|
|
246
|
+
// // seatingType: 'Default', // 情報空でよし
|
|
247
|
+
// seatNumber: '', // 情報空でよし
|
|
248
|
+
// seatRow: '', // 情報空でよし
|
|
249
|
+
// seatSection: '' // 情報空でよし
|
|
250
|
+
// }
|
|
251
|
+
// }
|
|
250
252
|
} }, {
|
|
251
253
|
validThrough: moment(`${mkknInfo.yykDt}+09:00`, 'YYYY/MM/DD HH:mm:ssZ')
|
|
252
254
|
.toDate()
|
|
@@ -14,6 +14,7 @@ const factory = require("../../factory");
|
|
|
14
14
|
const event_1 = require("../../repo/event");
|
|
15
15
|
const screeningEvent_1 = require("../../repo/itemAvailability/screeningEvent");
|
|
16
16
|
const offer_1 = require("../../repo/offer");
|
|
17
|
+
const offerCatalog_1 = require("../../repo/offerCatalog");
|
|
17
18
|
const place_1 = require("../../repo/place");
|
|
18
19
|
const product_1 = require("../../repo/product");
|
|
19
20
|
const project_1 = require("../../repo/project");
|
|
@@ -33,6 +34,7 @@ function call(data) {
|
|
|
33
34
|
event: new event_1.MongoRepository(settings.connection),
|
|
34
35
|
eventAvailability: new screeningEvent_1.RedisRepository(settings.redisClient),
|
|
35
36
|
offer: new offer_1.MongoRepository(settings.connection),
|
|
37
|
+
offerCatalog: new offerCatalog_1.MongoRepository(settings.connection),
|
|
36
38
|
offerRateLimit: new offer_2.RedisRepository(settings.redisClient),
|
|
37
39
|
place: new place_1.MongoRepository(settings.connection),
|
|
38
40
|
product: new product_1.MongoRepository(settings.connection),
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.293.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.293.0-alpha.1",
|
|
13
|
+
"@cinerino/sdk": "3.144.0-alpha.1",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.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.37"
|
|
124
124
|
}
|