@chevre/domain 20.2.0-alpha.5 → 20.2.0-alpha.51
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 +112 -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 +68 -1
- package/lib/chevre/repo/action.js +227 -6
- package/lib/chevre/repo/aggregation.d.ts +37 -0
- package/lib/chevre/repo/aggregation.js +67 -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 +4 -1
- package/lib/chevre/repo/project.js +9 -10
- 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 +45 -5
- package/lib/chevre/repo/transaction.js +187 -29
- 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.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +86 -59
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +5 -8
- package/lib/chevre/service/aggregation/system.d.ts +93 -0
- package/lib/chevre/service/aggregation/system.js +377 -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/factory.js +1 -0
- 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/factory.js +25 -5
- 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 +6 -2
- package/lib/chevre/service/offer.d.ts +13 -2
- package/lib/chevre/service/offer.js +86 -60
- 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 +5 -0
- package/lib/chevre/service/payment/any.js +7 -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 +2 -1
- package/lib/chevre/service/transaction/placeOrder.js +5 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +42 -27
- package/lib/chevre/service/transaction/placeOrderInProgress.js +7 -7
- 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/example/src/chevre/aggregateReservationOnProject.ts +0 -32
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
|
@@ -67,34 +67,42 @@ function addOffers2Seat(params) {
|
|
|
67
67
|
*/
|
|
68
68
|
function searchEventSeatOffers(params) {
|
|
69
69
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
var _a, _b, _c, _d, _e;
|
|
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
|
// 座席指定利用可能かどうか
|
|
76
|
-
const eventOffers =
|
|
80
|
+
const eventOffers = event.offers;
|
|
77
81
|
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
78
82
|
if (reservedSeatsAvailable) {
|
|
79
83
|
// 座席タイプ価格仕様を検索
|
|
80
84
|
const priceSpecs = yield repos.priceSpecification.search({
|
|
81
|
-
project: { id: { $eq:
|
|
85
|
+
project: { id: { $eq: event.project.id } },
|
|
82
86
|
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
83
87
|
appliesToCategoryCode: {
|
|
84
88
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
85
89
|
}
|
|
86
90
|
});
|
|
91
|
+
// const roomBranchCode = event.location.branchCode;
|
|
92
|
+
// const movieTheaterBranchCode = event.superEvent.location.branchCode;
|
|
93
|
+
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
94
|
+
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
87
95
|
const seats = yield repos.place.searchSeats({
|
|
88
|
-
project: { id: { $eq:
|
|
89
|
-
branchCode: { $in: (
|
|
96
|
+
project: { id: { $eq: event.project.id } },
|
|
97
|
+
branchCode: { $in: (_g = params.branchCode) === null || _g === void 0 ? void 0 : _g.$in },
|
|
90
98
|
containedInPlace: {
|
|
91
99
|
branchCode: {
|
|
92
|
-
$in: (
|
|
100
|
+
$in: (_j = (_h = params.containedInPlace) === null || _h === void 0 ? void 0 : _h.branchCode) === null || _j === void 0 ? void 0 : _j.$in
|
|
93
101
|
},
|
|
94
102
|
containedInPlace: {
|
|
95
|
-
branchCode: { $eq:
|
|
103
|
+
branchCode: { $eq: roomBranchCode },
|
|
96
104
|
containedInPlace: {
|
|
97
|
-
branchCode: { $eq:
|
|
105
|
+
branchCode: { $eq: movieTheaterBranchCode }
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
},
|
|
@@ -114,7 +122,7 @@ function searchEventSeatOffers(params) {
|
|
|
114
122
|
offers = seats.map((seat, index) => {
|
|
115
123
|
var _a;
|
|
116
124
|
return addOffers2Seat({
|
|
117
|
-
project:
|
|
125
|
+
project: event.project,
|
|
118
126
|
seat: seat,
|
|
119
127
|
seatSection: (_a = seat.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode,
|
|
120
128
|
unavailableOffers: [],
|
|
@@ -133,9 +141,13 @@ exports.searchEventSeatOffers = searchEventSeatOffers;
|
|
|
133
141
|
*/
|
|
134
142
|
function searchEventSeatOffersWithPaging(params) {
|
|
135
143
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
var _a, _b, _c, _d, _e, _f;
|
|
144
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
137
145
|
let offers = [];
|
|
138
|
-
|
|
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({
|
|
139
151
|
id: params.event.id
|
|
140
152
|
});
|
|
141
153
|
// 座席指定利用可能かどうか
|
|
@@ -152,12 +164,12 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
152
164
|
});
|
|
153
165
|
// const roomBranchCode = event.location.branchCode;
|
|
154
166
|
// const movieTheaterBranchCode = event.superEvent.location.branchCode;
|
|
155
|
-
const roomBranchCode = eventOffers.itemOffered.availableChannel.serviceLocation.branchCode;
|
|
156
|
-
const movieTheaterBranchCode = eventOffers.itemOffered.availableChannel.serviceLocation.containedInPlace.branchCode;
|
|
167
|
+
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
168
|
+
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
157
169
|
const seats = yield repos.place.searchSeats(Object.assign(Object.assign({}, params), { project: { id: { $eq: event.project.id } }, containedInPlace: {
|
|
158
170
|
branchCode: {
|
|
159
|
-
$eq: (typeof ((
|
|
160
|
-
? (
|
|
171
|
+
$eq: (typeof ((_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$eq) === 'string')
|
|
172
|
+
? (_k = (_j = params.containedInPlace) === null || _j === void 0 ? void 0 : _j.branchCode) === null || _k === void 0 ? void 0 : _k.$eq
|
|
161
173
|
: undefined
|
|
162
174
|
},
|
|
163
175
|
containedInPlace: {
|
|
@@ -200,57 +212,71 @@ exports.searchEventSeatOffersWithPaging = searchEventSeatOffersWithPaging;
|
|
|
200
212
|
*/
|
|
201
213
|
function onEventChanged(params) {
|
|
202
214
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
// numberOfTried: 0,
|
|
217
|
-
// executionResults: [],
|
|
218
|
-
// data: { id: event.id, typeOf: event.typeOf }
|
|
219
|
-
// };
|
|
220
|
-
// await repos.task.save(aggregateTask);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
// イベント通知タスク
|
|
224
|
-
// 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
|
+
}
|
|
225
228
|
}
|
|
226
229
|
});
|
|
227
230
|
}
|
|
228
231
|
exports.onEventChanged = onEventChanged;
|
|
229
232
|
function createAggregateScreeningEventIfNotExist(params) {
|
|
230
233
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
+
});
|
|
251
275
|
}
|
|
252
|
-
}
|
|
253
|
-
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (aggregateTasks.length > 0) {
|
|
279
|
+
yield repos.task.saveMany(aggregateTasks);
|
|
254
280
|
}
|
|
255
281
|
});
|
|
256
282
|
}
|
|
@@ -30,34 +30,31 @@ function getOrderWithToken(params) {
|
|
|
30
30
|
return params.order;
|
|
31
31
|
}
|
|
32
32
|
// 冗長な個人情報をマスク(最低限の情報に)
|
|
33
|
-
const customer4orderToken
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
33
|
+
// const customer4orderToken: factory.order.ISimpleCustomer =
|
|
34
|
+
// (params.order.customer.typeOf === factory.organizationType.Organization)
|
|
35
|
+
// ? {
|
|
36
|
+
// id: params.order.customer.id,
|
|
37
|
+
// name: '****',
|
|
38
|
+
// // project: params.order.customer.project,
|
|
39
|
+
// typeOf: params.order.customer.typeOf
|
|
40
|
+
// }
|
|
41
|
+
// : {
|
|
42
|
+
// id: params.order.customer.id,
|
|
43
|
+
// typeOf: params.order.customer.typeOf
|
|
44
|
+
// };
|
|
45
|
+
// const seller4orderToken: Omit<factory.order.ISeller, 'name'> = {
|
|
46
|
+
// id: params.order.seller.id,
|
|
47
|
+
// typeOf: params.order.seller.typeOf
|
|
48
|
+
// };
|
|
49
|
+
// 最適化(2023-01-31~)
|
|
50
50
|
const order4token = {
|
|
51
|
-
// project: params.order.project,
|
|
52
51
|
typeOf: params.order.typeOf,
|
|
53
|
-
seller: seller4orderToken,
|
|
54
|
-
customer: customer4orderToken,
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
priceCurrency: params.order.priceCurrency,
|
|
60
|
-
orderDate: params.order.orderDate
|
|
52
|
+
// seller: seller4orderToken,
|
|
53
|
+
// customer: customer4orderToken,
|
|
54
|
+
orderNumber: params.order.orderNumber
|
|
55
|
+
// price: params.order.price,
|
|
56
|
+
// priceCurrency: params.order.priceCurrency,
|
|
57
|
+
// orderDate: params.order.orderDate
|
|
61
58
|
};
|
|
62
59
|
const token = yield new Promise((resolve, reject) => {
|
|
63
60
|
// 所有権を暗号化する
|
|
@@ -184,7 +181,8 @@ function createConfirmReservationActionObject4ChevreByOrder(params) {
|
|
|
184
181
|
const chevreReservationNumbers = (Array.isArray(params.order.acceptedOffers))
|
|
185
182
|
? params.order.acceptedOffers.filter((o) => {
|
|
186
183
|
var _a;
|
|
187
|
-
return o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
184
|
+
return (o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
185
|
+
|| o.itemOffered.typeOf === factory.reservationType.BusReservation)
|
|
188
186
|
&& ((_a = o.offeredThrough) === null || _a === void 0 ? void 0 : _a.identifier) === factory.service.webAPI.Identifier.Chevre;
|
|
189
187
|
})
|
|
190
188
|
.map((o) => {
|
|
@@ -271,7 +271,8 @@ function createReturnReserveTransactionTasks(order, simpleOrder) {
|
|
|
271
271
|
// 注文アイテムから返却アクションを作成する
|
|
272
272
|
const acceptedOffers = (Array.isArray(order.acceptedOffers)) ? order.acceptedOffers : [];
|
|
273
273
|
for (const acceptedOffer of acceptedOffers) {
|
|
274
|
-
if (acceptedOffer.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
274
|
+
if (acceptedOffer.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
275
|
+
|| acceptedOffer.itemOffered.typeOf === factory.reservationType.BusReservation) {
|
|
275
276
|
const reservation = acceptedOffer.itemOffered;
|
|
276
277
|
const reservationNumber = reservation.reservationNumber;
|
|
277
278
|
// 予約番号ごとに返却アクションを作成する
|
|
@@ -41,6 +41,22 @@ function createOrder(params) {
|
|
|
41
41
|
: undefined) });
|
|
42
42
|
return Object.assign(Object.assign({}, o), { itemOffered });
|
|
43
43
|
}
|
|
44
|
+
else if (o.itemOffered.typeOf === factory.reservationType.BusReservation) {
|
|
45
|
+
let itemOffered = o.itemOffered;
|
|
46
|
+
const reservationFor = itemOffered.reservationFor;
|
|
47
|
+
itemOffered = Object.assign(Object.assign({}, itemOffered), { reservationFor: Object.assign(Object.assign(Object.assign({}, reservationFor), (reservationFor.arrivalTime !== undefined)
|
|
48
|
+
? {
|
|
49
|
+
arrivalTime: moment(reservationFor.arrivalTime)
|
|
50
|
+
.toDate()
|
|
51
|
+
}
|
|
52
|
+
: undefined), (reservationFor.departureTime !== undefined)
|
|
53
|
+
? {
|
|
54
|
+
departureTime: moment(reservationFor.departureTime)
|
|
55
|
+
.toDate()
|
|
56
|
+
}
|
|
57
|
+
: undefined) });
|
|
58
|
+
return Object.assign(Object.assign({}, o), { itemOffered });
|
|
59
|
+
}
|
|
44
60
|
else {
|
|
45
61
|
return o;
|
|
46
62
|
}
|
|
@@ -21,7 +21,7 @@ function returnOrder(params) {
|
|
|
21
21
|
? params.object.dateReturned
|
|
22
22
|
: new Date();
|
|
23
23
|
const returner = params.agent;
|
|
24
|
-
let order = yield repos.order.findByOrderNumber({ orderNumber });
|
|
24
|
+
let order = yield repos.order.findByOrderNumber({ orderNumber, inclusion: [], exclusion: [] });
|
|
25
25
|
// プロジェクト条件検証
|
|
26
26
|
if (order.project.id !== params.project.id) {
|
|
27
27
|
throw new factory.errors.NotFound('Order');
|
|
@@ -202,8 +202,10 @@ function onReturn(returnActionAttributes) {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
// タスク保管
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
// saveManyに変更(2023-02-01~)
|
|
206
|
+
yield repos.task.saveMany(taskAttributes);
|
|
207
|
+
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
208
|
+
// return repos.task.save(taskAttribute);
|
|
209
|
+
// }));
|
|
208
210
|
});
|
|
209
211
|
}
|
|
@@ -31,7 +31,7 @@ function sendOrder(params) {
|
|
|
31
31
|
orderNumber
|
|
32
32
|
})({ transaction: repos.transaction });
|
|
33
33
|
// 注文取得
|
|
34
|
-
let order = yield repos.order.findByOrderNumber({ orderNumber });
|
|
34
|
+
let order = yield repos.order.findByOrderNumber({ orderNumber, inclusion: [], exclusion: [] });
|
|
35
35
|
// プロジェクト条件検証
|
|
36
36
|
if (order.project.id !== params.project.id) {
|
|
37
37
|
throw new factory.errors.NotFound('Order');
|
|
@@ -100,7 +100,9 @@ function sendOrder(params) {
|
|
|
100
100
|
let throwsError = true;
|
|
101
101
|
// すでにOrderReturnedだった場合、OrderDelivered->OrderReturnedの処理自体は成功しているので、後処理を続行する
|
|
102
102
|
const currentOrder = yield repos.order.findByOrderNumber({
|
|
103
|
-
orderNumber: params.object.orderNumber
|
|
103
|
+
orderNumber: params.object.orderNumber,
|
|
104
|
+
inclusion: ['orderStatus'],
|
|
105
|
+
exclusion: []
|
|
104
106
|
});
|
|
105
107
|
if ((currentOrder === null || currentOrder === void 0 ? void 0 : currentOrder.orderStatus) === factory.orderStatus.OrderReturned) {
|
|
106
108
|
throwsError = false;
|
|
@@ -47,7 +47,12 @@ declare function invalidatePaymentUrl(params: factory.task.IData<factory.taskNam
|
|
|
47
47
|
*/
|
|
48
48
|
declare function processVoidPayTransaction(params: factory.task.IData<factory.taskName.VoidPayTransaction>): (repos: {
|
|
49
49
|
action: ActionRepo;
|
|
50
|
+
accountingReport: AccountingReportRepo;
|
|
50
51
|
assetTransaction: AssetTransactionRepo;
|
|
52
|
+
product: ProductRepo;
|
|
53
|
+
project: ProjectRepo;
|
|
54
|
+
seller: SellerRepo;
|
|
55
|
+
task: TaskRepo;
|
|
51
56
|
transaction: TransactionRepo;
|
|
52
57
|
}) => Promise<void>;
|
|
53
58
|
interface IAuthorizeRepos {
|
|
@@ -189,7 +189,7 @@ function publishPaymentUrl(params) {
|
|
|
189
189
|
};
|
|
190
190
|
yield repos.transaction.findByIdAndUpdate({
|
|
191
191
|
id: transaction.id,
|
|
192
|
-
update: { 'object.paymentMethods': paymentMethodByPaymentUrl }
|
|
192
|
+
update: { $set: { 'object.paymentMethods': paymentMethodByPaymentUrl } }
|
|
193
193
|
});
|
|
194
194
|
return result;
|
|
195
195
|
});
|
|
@@ -288,6 +288,12 @@ function validateFromLocation(params) {
|
|
|
288
288
|
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
289
289
|
token: fromLocation
|
|
290
290
|
})(repos);
|
|
291
|
+
if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
|
|
292
|
+
throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
|
|
293
|
+
}
|
|
294
|
+
if (paymentCardOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
295
|
+
throw new factory.errors.Argument('fromLocation', 'must be Permit');
|
|
296
|
+
}
|
|
291
297
|
accountId = paymentCardOwnershipInfo.typeOfGood.identifier;
|
|
292
298
|
}
|
|
293
299
|
return { accountId };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
|
|
2
2
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
3
|
-
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
3
|
+
import { IMinimizedIndividualEvent, MongoRepository as EventRepo } from '../../repo/event';
|
|
4
4
|
import { MongoRepository as ProductRepo } from '../../repo/product';
|
|
5
5
|
import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
6
6
|
import { MongoRepository as SellerRepo } from '../../repo/seller';
|
|
@@ -50,7 +50,7 @@ declare function checkMovieTicket(params: factory.action.check.paymentMethod.mov
|
|
|
50
50
|
declare function checkByIdentifier(params: {
|
|
51
51
|
movieTickets: IMovieTicket[];
|
|
52
52
|
seller: factory.seller.ISeller;
|
|
53
|
-
screeningEvent:
|
|
53
|
+
screeningEvent: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
54
54
|
paymentServiceId: string;
|
|
55
55
|
}): (repos: {
|
|
56
56
|
product: ProductRepo;
|
|
@@ -53,7 +53,11 @@ function checkMovieTicket(params) {
|
|
|
53
53
|
}
|
|
54
54
|
// イベント情報取得
|
|
55
55
|
let screeningEvent;
|
|
56
|
-
|
|
56
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
57
|
+
// screeningEvent = await repos.event.findById<factory.eventType.ScreeningEvent>({
|
|
58
|
+
// id: eventIds[0]
|
|
59
|
+
// });
|
|
60
|
+
screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
57
61
|
id: eventIds[0]
|
|
58
62
|
});
|
|
59
63
|
// ショップ情報取得
|
|
@@ -432,7 +436,9 @@ function payActionParams2seatInfoSyncIn(params) {
|
|
|
432
436
|
if (eventIds.length !== 1) {
|
|
433
437
|
throw new factory.errors.Argument('movieTickets', 'Number of events must be 1');
|
|
434
438
|
}
|
|
435
|
-
|
|
439
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
440
|
+
// const event = await repos.event.findById<factory.eventType.ScreeningEvent>({ id: eventIds[0] });
|
|
441
|
+
const event = yield repos.event.findMinimizedIndividualEventById({ id: eventIds[0] });
|
|
436
442
|
const seller = yield repos.seller.findById({ id: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) });
|
|
437
443
|
// 全購入管理番号のMovieTicketをマージ
|
|
438
444
|
const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
|
|
@@ -77,8 +77,10 @@ function onRegistered(actionAttributes, __) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
// タスク保管
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
// saveManyに変更(2023-02-01~)
|
|
81
|
+
yield repos.task.saveMany(taskAttributes);
|
|
82
|
+
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
83
|
+
// return repos.task.save(taskAttribute);
|
|
84
|
+
// }));
|
|
83
85
|
});
|
|
84
86
|
}
|
|
@@ -181,7 +181,7 @@ function createSellerFlow(measuredFrom, measuredThrough, sellerId) {
|
|
|
181
181
|
const actionsOnExpiredTransactions = yield repos.action.search({
|
|
182
182
|
typeOf: { $eq: factory.actionType.AuthorizeAction },
|
|
183
183
|
purpose: { id: { $in: expiredTransactionIds } }
|
|
184
|
-
});
|
|
184
|
+
}, [], []);
|
|
185
185
|
debug(actionsOnExpiredTransactions.length, 'actionsOnExpiredTransactions found.');
|
|
186
186
|
const numbersOfActionsOnExpired = expiredTransactionIds.map((transactionId) => {
|
|
187
187
|
return actionsOnExpiredTransactions.filter((action) => action.purpose.id === transactionId).length;
|
|
@@ -17,11 +17,11 @@ function checkInRerservation(params) {
|
|
|
17
17
|
// 発券処理(Array対応)
|
|
18
18
|
let checkedInReservationIds;
|
|
19
19
|
if (Array.isArray(params.object.ids) && params.object.ids.length > 0) {
|
|
20
|
-
yield repos.reservation.
|
|
20
|
+
yield repos.reservation.checkInIfNot({ id: { $in: params.object.ids }, now });
|
|
21
21
|
checkedInReservationIds = params.object.ids;
|
|
22
22
|
}
|
|
23
23
|
if (Array.isArray(params.object.reservationNumbers) && params.object.reservationNumbers.length > 0) {
|
|
24
|
-
yield repos.reservation.
|
|
24
|
+
yield repos.reservation.checkInIfNot({ reservationNumber: { $in: params.object.reservationNumbers }, now });
|
|
25
25
|
// 予約番号リストを予約IDリストに変換
|
|
26
26
|
checkedInReservationIds = yield repos.reservation.searchIdsByReservationNumber({
|
|
27
27
|
reservationNumber: { $in: params.object.reservationNumbers }
|
|
@@ -37,17 +37,14 @@ function confirmReservation(actionAttributesList) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
+
// 廃止(2023-01-18)
|
|
41
|
+
throw new factory.errors.Forbidden(`${reservation.typeOf} not acceptable`);
|
|
40
42
|
// 予約を確定状態に変更する
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
previousReservationStatus: reservation.reservationStatus,
|
|
47
|
-
underName: reservation.underName
|
|
48
|
-
// issuedThroughは予約取引開始時に確定しているので更新不要(2022-12-21~)
|
|
49
|
-
// reservedTicket: reservation.reservedTicket
|
|
50
|
-
});
|
|
43
|
+
// await repos.reservation.confirm<factory.reservationType.EventReservation>({
|
|
44
|
+
// id: reservation.id,
|
|
45
|
+
// previousReservationStatus: reservation.reservationStatus,
|
|
46
|
+
// underName: reservation.underName
|
|
47
|
+
// });
|
|
51
48
|
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
52
49
|
// delete (<any>reservation)._id;
|
|
53
50
|
// confirmedReservations.push(reservation);
|
|
@@ -96,7 +96,8 @@ function onReservationCanceled(canceledReservations, useInformReservation) {
|
|
|
96
96
|
// 冗長な作成を避ける
|
|
97
97
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
98
98
|
project,
|
|
99
|
-
reservationFor: { id: canceledReservations[0].reservationFor.id }
|
|
99
|
+
reservationFor: [{ id: canceledReservations[0].reservationFor.id }],
|
|
100
|
+
force: false
|
|
100
101
|
})({ task: repos.task });
|
|
101
102
|
}
|
|
102
103
|
});
|
|
@@ -116,7 +116,8 @@ function onReservationCheckedIn(params) {
|
|
|
116
116
|
yield Promise.all(reservationForIds.map((reservationForId) => __awaiter(this, void 0, void 0, function* () {
|
|
117
117
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
118
118
|
project: { id: params.project.id },
|
|
119
|
-
reservationFor: { id: reservationForId }
|
|
119
|
+
reservationFor: [{ id: reservationForId }],
|
|
120
|
+
force: false
|
|
120
121
|
})({ task: repos.task });
|
|
121
122
|
})));
|
|
122
123
|
}
|
|
@@ -98,7 +98,8 @@ function onReservationConfirmed(confirmedReservations) {
|
|
|
98
98
|
if (Array.isArray(confirmedReservations) && confirmedReservations.length > 0) {
|
|
99
99
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
100
100
|
project: confirmedReservations[0].project,
|
|
101
|
-
reservationFor: { id: confirmedReservations[0].reservationFor.id }
|
|
101
|
+
reservationFor: [{ id: confirmedReservations[0].reservationFor.id }],
|
|
102
|
+
force: false
|
|
102
103
|
})({ task: repos.task });
|
|
103
104
|
const now = new Date();
|
|
104
105
|
const taskAttributes = [];
|