@chevre/domain 23.1.0-alpha.8 → 23.1.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.
Files changed (98) hide show
  1. package/example/src/chevre/{eventOffer/adminEventOffers.ts → acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts} +12 -11
  2. package/example/src/chevre/actions/checkAcceptPayActions.ts +60 -0
  3. package/example/src/chevre/assetTransaction/checkPayTransactionsTicketToken.ts +67 -0
  4. package/example/src/chevre/assetTransaction/processReserve.ts +7 -3
  5. package/example/src/chevre/authorizeEventServiceOffer.ts +6 -5
  6. package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +93 -0
  7. package/example/src/chevre/importEventsFromCOA.ts +5 -5
  8. package/example/src/chevre/member/migrateMemberIdentifier.ts +20 -15
  9. package/example/src/chevre/pendingReservation/findEventSeatOffersBySection.ts +46 -0
  10. package/example/src/chevre/place/checkSectionCount.ts +27 -0
  11. package/example/src/chevre/place/findSectionsByRoom.ts +50 -0
  12. package/example/src/chevre/project/unsetProjectSettings.ts +73 -0
  13. package/example/src/chevre/reIndex.ts +1 -2
  14. package/example/src/chevre/roles/{addAdminSellerEventIfNotExists.ts → addAdminSellerEventOfferIfNotExists.ts} +1 -1
  15. package/example/src/chevre/stockHolder/findSeatsBySection.ts +59 -0
  16. package/example/src/chevre/stockHolder/searchSeats.ts +2 -2
  17. package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -0
  18. package/lib/chevre/repo/acceptedPaymentMethod.js +180 -0
  19. package/lib/chevre/repo/authorization.d.ts +3 -2
  20. package/lib/chevre/repo/authorization.js +13 -5
  21. package/lib/chevre/repo/event.d.ts +1 -35
  22. package/lib/chevre/repo/event.js +2 -102
  23. package/lib/chevre/repo/eventOffer.js +3 -3
  24. package/lib/chevre/repo/mongoose/schemas/acceptedPaymentMethod.d.ts +10 -0
  25. package/lib/chevre/repo/mongoose/schemas/acceptedPaymentMethod.js +97 -0
  26. package/lib/chevre/repo/mongoose/schemas/eventOffer.js +48 -35
  27. package/lib/chevre/repo/mongoose/schemas/member.js +10 -0
  28. package/lib/chevre/repo/note.js +4 -2
  29. package/lib/chevre/repo/pendingReservation.js +28 -71
  30. package/lib/chevre/repo/place/seat.d.ts +24 -0
  31. package/lib/chevre/repo/place/seat.js +103 -21
  32. package/lib/chevre/repo/place/section.d.ts +20 -0
  33. package/lib/chevre/repo/place/section.js +47 -0
  34. package/lib/chevre/repo/ticket.d.ts +7 -1
  35. package/lib/chevre/repo/ticket.js +14 -1
  36. package/lib/chevre/repository.d.ts +5 -0
  37. package/lib/chevre/repository.js +15 -2
  38. package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
  39. package/lib/chevre/service/assetTransaction/pay/factory.js +8 -3
  40. package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.d.ts +16 -0
  41. package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.js +94 -0
  42. package/lib/chevre/service/assetTransaction/pay.d.ts +6 -1
  43. package/lib/chevre/service/assetTransaction/pay.js +6 -1
  44. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +4 -0
  45. package/lib/chevre/service/assetTransaction/reserve/start.js +4 -1
  46. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.d.ts +2 -2
  47. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.js +8 -8
  48. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +7 -2
  49. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +32 -32
  50. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +1 -1
  51. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +10 -54
  52. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.d.ts +23 -0
  53. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.js +62 -0
  54. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +34 -1
  55. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +21 -9
  56. package/lib/chevre/service/offer/event/authorize/factory.d.ts +0 -4
  57. package/lib/chevre/service/offer/event/authorize/factory.js +2 -5
  58. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +1 -1
  59. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -0
  60. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -7
  61. package/lib/chevre/service/offer/event/authorize.d.ts +1 -0
  62. package/lib/chevre/service/offer/event/authorize.js +7 -7
  63. package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +48 -0
  64. package/lib/chevre/service/offer/event/issueEventOfferTicket.js +123 -0
  65. package/lib/chevre/service/offer/event.d.ts +2 -1
  66. package/lib/chevre/service/offer/event.js +3 -1
  67. package/lib/chevre/service/offer.d.ts +31 -1
  68. package/lib/chevre/service/offer.js +104 -34
  69. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +9 -0
  70. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.js +22 -11
  71. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +19 -2
  72. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +87 -9
  73. package/lib/chevre/service/payment/any/factory.d.ts +20 -3
  74. package/lib/chevre/service/payment/any/factory.js +26 -6
  75. package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +4 -0
  76. package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.js +15 -11
  77. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +6 -3
  78. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +8 -22
  79. package/lib/chevre/service/payment/any.d.ts +5 -1
  80. package/lib/chevre/service/payment/any.js +22 -13
  81. package/lib/chevre/service/payment/factory.js +0 -5
  82. package/lib/chevre/service/payment/movieTicket/authorize.js +0 -5
  83. package/lib/chevre/service/task/authorizePayment.js +2 -0
  84. package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
  85. package/lib/chevre/service/transaction/placeOrder/confirm/publishCode.js +1 -1
  86. package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +9 -0
  87. package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.js +2 -0
  88. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +8 -0
  89. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.js +45 -0
  90. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validatePrice.d.ts +3 -0
  91. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validatePrice.js +38 -0
  92. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -8
  93. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +5 -35
  94. package/package.json +3 -3
  95. package/example/src/chevre/checkReplaceActions.ts +0 -65
  96. package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +0 -193
  97. package/lib/chevre/service/code.d.ts +0 -8
  98. package/lib/chevre/service/code.js +0 -7
@@ -44,41 +44,54 @@ const schemaOptions = {
44
44
  }
45
45
  };
46
46
  const indexes = [
47
- // [
48
- // { validFrom: 1 },
49
- // { name: 'validFrom' }
50
- // ],
51
- // [
52
- // {
53
- // 'project.id': 1,
54
- // 'itemOffered.id': 1,
55
- // identifier: 1
56
- // },
57
- // {
58
- // name: 'uniqueByItemOfferedAndIdentifier',
59
- // unique: true
60
- // }
61
- // ],
62
- // [
63
- // { 'project.id': 1, validFrom: 1 },
64
- // { name: 'projectId' }
65
- // ],
66
- // [
67
- // { identifier: 1, validFrom: 1 },
68
- // { name: 'identifier' }
69
- // ],
70
- // [
71
- // { 'itemOffered.id': 1, validFrom: 1 },
72
- // { name: 'itemOfferedId' }
73
- // ],
74
- // [
75
- // { 'seller.id': 1, validFrom: 1 },
76
- // { name: 'sellerId' }
77
- // ],
78
- // [
79
- // { validThrough: 1, validFrom: 1 },
80
- // { name: 'validThrough' }
81
- // ]
47
+ [
48
+ { validFrom: 1 },
49
+ { name: 'validFrom' }
50
+ ],
51
+ [
52
+ { validThrough: 1, validFrom: 1 },
53
+ { name: 'validThrough' }
54
+ ],
55
+ [
56
+ {
57
+ 'project.id': 1,
58
+ 'itemOffered.id': 1,
59
+ identifier: 1
60
+ },
61
+ {
62
+ name: 'uniqueByItemOfferedAndIdentifier',
63
+ unique: true
64
+ }
65
+ ],
66
+ [
67
+ { 'project.id': 1, validFrom: 1 },
68
+ { name: 'projectId' }
69
+ ],
70
+ [
71
+ { 'seller.id': 1, validFrom: 1 },
72
+ { name: 'sellerId' }
73
+ ],
74
+ [
75
+ { identifier: 1, validFrom: 1 },
76
+ { name: 'identifier' }
77
+ ],
78
+ [
79
+ { 'itemOffered.id': 1, validFrom: 1 },
80
+ { name: 'itemOfferedId' }
81
+ ],
82
+ [
83
+ { 'availableAtOrFrom.identifier': 1, validFrom: 1 },
84
+ { name: 'availableAtOrFrom' }
85
+ ],
86
+ [
87
+ { 'offeredBy.identifier': 1, validFrom: 1 },
88
+ {
89
+ name: 'offeredByIdentifier',
90
+ partialFilterExpression: {
91
+ 'offeredBy.identifier': { $exists: true }
92
+ }
93
+ }
94
+ ]
82
95
  ];
83
96
  exports.indexes = indexes;
84
97
  /**
@@ -61,6 +61,16 @@ const indexes = [
61
61
  }
62
62
  }
63
63
  ],
64
+ [
65
+ { 'project.id': 1, 'member.identifier': 1 }, // アプリケーションコード追加(2025-11-17~)
66
+ {
67
+ name: 'uniqueByMemberIdentifier',
68
+ unique: true,
69
+ partialFilterExpression: {
70
+ 'member.identifier': { $exists: true }
71
+ }
72
+ }
73
+ ],
64
74
  [
65
75
  { 'project.id': 1, 'member.id': 1, 'member.memberOf.id': 1 },
66
76
  {
@@ -192,8 +192,10 @@ class NoteRepo {
192
192
  })
193
193
  .lean()
194
194
  .exec();
195
- // tslint:disable-next-line:no-console
196
- console.log('NoteRepo.upsertNotesByIdentifier:', params.length, 'params ->', modifyingNotes.length, 'modifyingNotes found.', JSON.stringify(modifyingNotes));
195
+ // console.log(
196
+ // 'NoteRepo.upsertNotesByIdentifier:',
197
+ // params.length, 'params ->', modifyingNotes.length, 'modifyingNotes found.', JSON.stringify(modifyingNotes)
198
+ // );
197
199
  if (modifyingNotes.length !== bulkWriteOps.length) {
198
200
  throw new factory.errors.NotFound(factory.creativeWorkType.NoteDigitalDocument);
199
201
  }
@@ -286,34 +286,38 @@ class PendingReservationRepo {
286
286
  });
287
287
  });
288
288
  }
289
- // public async searchHolders2(params: {
289
+ // public async findSubReservationsByEvent(params: {
290
+ // limit: number;
291
+ // page: number;
290
292
  // project: { id: string };
291
293
  // eventId: string;
292
- // startDate: Date;
293
- // hasTicketedSeat: boolean;
294
- // offers: IOffer[];
295
- // }): Promise<IGetHolderResult[]> {
296
- // const { eventId, offers, hasTicketedSeat } = params;
297
- // const reservationIdentifiers = offers.map((offer) => PendingReservationRepo.offer2identifier(offer, hasTicketedSeat));
294
+ // }): Promise<{
295
+ // // reservationNumber: string;
296
+ // identifier: string;
297
+ // }[]> {
298
+ // const { limit, page, eventId } = params;
298
299
  // const aggregate = this.pendingReservationModel.aggregate<{
299
- // // reservationNumber: string;
300
300
  // identifier: string;
301
301
  // }>([
302
- // // unwind,matchの順序
303
- // // unwind->matchでは遅い?
304
- // // match->limit->unwind->matchにする
305
302
  // {
306
- // $unwind: {
307
- // path: '$subReservation'
303
+ // $match: {
304
+ // 'reservationFor.id': { $eq: eventId },
305
+ // 'subReservation.identifier': { $exists: true }
308
306
  // }
309
307
  // },
308
+ // // { $sort: { bookingTime: factory.sortType.Descending } },
310
309
  // {
311
- // $match: {
312
- // 'reservationFor.id': { $eq: eventId },
313
- // 'subReservation.identifier': { $exists: true, $in: reservationIdentifiers }
310
+ // $unwind: {
311
+ // path: '$subReservation'
314
312
  // }
315
313
  // },
316
- // { $limit: reservationIdentifiers.length },
314
+ // { $sort: { 'subReservation.identifier': factory.sortType.Ascending } },
315
+ // // {
316
+ // // $match: {
317
+ // // // セクションで絞ってみる
318
+ // // 'subReservation.identifier': { $regex: new RegExp('^Default:') }
319
+ // // }
320
+ // // },
317
321
  // {
318
322
  // $project: {
319
323
  // _id: 0,
@@ -322,64 +326,17 @@ class PendingReservationRepo {
322
326
  // }
323
327
  // }
324
328
  // ]);
325
- // const docs = await aggregate
326
- // .option({ maxTimeMS: MONGO_MAX_TIME_MS })
327
- // .exec();
328
- // debug('searchHolders: aggregated.', docs, docs.length, 'docs');
329
- // // reservationNumberを正確に返す必要はなく、存在しているかどうかだけ分かればよい(stringを返せばよい)
330
- // return reservationIdentifiers.map((reservationIdentifier) => {
331
- // const doc = docs.find(({ identifier }) => identifier === reservationIdentifier);
332
- // // tslint:disable-next-line:no-null-keyword
333
- // // return (doc !== undefined) ? doc.reservationNumber : null;
334
- // // tslint:disable-next-line:no-null-keyword
335
- // return (doc !== undefined) ? doc.identifier : null;
336
- // });
337
- // }
338
- // public async searchHoldersByDistinct(params: {
339
- // project: { id: string };
340
- // eventId: string;
341
- // startDate: Date;
342
- // hasTicketedSeat: boolean;
343
- // offers: IOffer[];
344
- // }) {
345
- // const { eventId, offers, hasTicketedSeat } = params;
346
- // const reservationIdentifiers = offers.map((offer) => PendingReservationRepo.offer2identifier(offer, hasTicketedSeat));
347
- // const doc = await this.pendingReservationModel.distinct(
348
- // 'subReservation.identifier',
349
- // {
350
- // 'reservationFor.id': { $eq: eventId },
351
- // 'subReservation.identifier': { $exists: true, $in: reservationIdentifiers }
352
- // }
353
- // )
354
- // .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
355
- // .exec();
356
- // debug('searchHolders: distinct.', doc);
357
- // return doc;
358
- // }
359
- // public async getSize(params: Omit<IUnlockKey, 'holder' | 'offer'>) {
360
- // const { eventId } = params;
361
- // const aggregate = this.aggregateReservationModel.aggregate([
362
- // {
363
- // $match: {
364
- // 'reservationFor.id': { $eq: eventId }
365
- // }
366
- // },
367
- // {
368
- // $project: {
369
- // typeOf: 1,
370
- // objectSize: { $bsonSize: '$$ROOT' }
371
- // }
372
- // }
373
- // ]);
329
+ // if (typeof limit === 'number' && limit > 0) {
330
+ // const pageMustBePositive: number = (typeof page === 'number' && page > 0) ? page : 1;
331
+ // aggregate.skip(limit * (pageMustBePositive - 1))
332
+ // .limit(limit);
333
+ // } else {
334
+ // throw new factory.errors.Argument('limit', 'must be number > 0');
335
+ // }
374
336
  // return aggregate
375
337
  // .option({ maxTimeMS: MONGO_MAX_TIME_MS })
376
338
  // .exec();
377
339
  // }
378
- // public getCursor(conditions: FilterQuery<any>, projection: any) {
379
- // return this.aggregateReservationModel.find(conditions, projection)
380
- // .sort({ bookingTime: factory.sortType.Ascending })
381
- // .cursor();
382
- // }
383
340
  docExists(params) {
384
341
  return __awaiter(this, void 0, void 0, function* () {
385
342
  const { eventId } = params;
@@ -79,6 +79,30 @@ export declare class SeatRepo {
79
79
  };
80
80
  };
81
81
  }): Promise<factory.place.seat.IPlace[]>;
82
+ /**
83
+ * セクション指定の座席検索として再定義(2025-12-06~)
84
+ */
85
+ findSeatsBySection(params: {
86
+ limit: number;
87
+ page: number;
88
+ projectId: string;
89
+ /**
90
+ * 販売者ID
91
+ */
92
+ sellerId: string;
93
+ /**
94
+ * 施設コード
95
+ */
96
+ movieTheaterCode: string;
97
+ /**
98
+ * ルームコード
99
+ */
100
+ roomCode: string;
101
+ /**
102
+ * セクションコード
103
+ */
104
+ sectionCode: string;
105
+ }, options: Pick<factory.place.seat.ISearchConditions, 'branchCode' | 'seatingType'>): Promise<Pick<factory.place.seat.IPlace, 'additionalProperty' | 'branchCode' | 'maximumAttendeeCapacity' | 'name' | 'seatingType'>[]>;
82
106
  /**
83
107
  * 座席区分集計検索
84
108
  */
@@ -39,30 +39,29 @@ class SeatRepo {
39
39
  const includeSectionName = params['containedInPlace.name'] !== 0;
40
40
  const includeSectionTypeOf = params['containedInPlace.typeOf'] !== 0;
41
41
  const includeScreeningRooms = params['containedInPlace.containedInPlace'] !== 0;
42
- const projectStage = {
43
- _id: 0,
44
- typeOf: '$containsPlace.containsPlace.typeOf',
45
- branchCode: '$containsPlace.containsPlace.branchCode',
46
- name: '$containsPlace.containsPlace.name',
47
- seatingType: '$containsPlace.containsPlace.seatingType',
48
- maximumAttendeeCapacity: '$containsPlace.containsPlace.maximumAttendeeCapacity', // add maximumAttendeeCapacity(2024-04-02~)
49
- containedInPlace: Object.assign(Object.assign(Object.assign(Object.assign({}, (includeSectionBranchCode) ? { branchCode: '$containsPlace.branchCode' } : undefined), (includeSectionName) ? { name: '$containsPlace.name' } : undefined), (includeSectionTypeOf) ? { typeOf: '$containsPlace.typeOf' } : undefined), (includeScreeningRooms)
50
- ? {
51
- containedInPlace: {
52
- typeOf: '$typeOf',
53
- branchCode: '$branchCode',
54
- name: '$name',
42
+ /**
43
+ * containedInPlaceについて何かしたprojectするかどうか
44
+ */
45
+ const includeContaindInPlace = includeSectionBranchCode || includeSectionName || includeSectionTypeOf || includeScreeningRooms;
46
+ const projectStage = Object.assign(Object.assign({ _id: 0, typeOf: '$containsPlace.containsPlace.typeOf', branchCode: '$containsPlace.containsPlace.branchCode', name: '$containsPlace.containsPlace.name', seatingType: '$containsPlace.containsPlace.seatingType', maximumAttendeeCapacity: '$containsPlace.containsPlace.maximumAttendeeCapacity' }, (includeContaindInPlace)
47
+ ? {
48
+ containedInPlace: Object.assign(Object.assign(Object.assign(Object.assign({}, (includeSectionBranchCode) ? { branchCode: '$containsPlace.branchCode' } : undefined), (includeSectionName) ? { name: '$containsPlace.name' } : undefined), (includeSectionTypeOf) ? { typeOf: '$containsPlace.typeOf' } : undefined), (includeScreeningRooms)
49
+ ? {
55
50
  containedInPlace: {
56
- id: '$containedInPlace.id',
57
- typeOf: '$containedInPlace.typeOf',
58
- branchCode: '$containedInPlace.branchCode',
59
- name: '$containedInPlace.name'
51
+ typeOf: '$typeOf',
52
+ branchCode: '$branchCode',
53
+ name: '$name',
54
+ containedInPlace: {
55
+ id: '$containedInPlace.id',
56
+ typeOf: '$containedInPlace.typeOf',
57
+ branchCode: '$containedInPlace.branchCode',
58
+ name: '$containedInPlace.name'
59
+ }
60
60
  }
61
61
  }
62
- }
63
- : undefined),
64
- additionalProperty: '$containsPlace.containsPlace.additionalProperty'
65
- };
62
+ : undefined)
63
+ }
64
+ : undefined), { additionalProperty: '$containsPlace.containsPlace.additionalProperty' });
66
65
  Object.keys(params)
67
66
  .forEach((field) => {
68
67
  if (typeof projectStage[field] === 'string') {
@@ -445,6 +444,89 @@ class SeatRepo {
445
444
  .exec();
446
445
  });
447
446
  }
447
+ /**
448
+ * セクション指定の座席検索として再定義(2025-12-06~)
449
+ */
450
+ findSeatsBySection(params, options) {
451
+ return __awaiter(this, void 0, void 0, function* () {
452
+ const { limit, page, projectId, sellerId, movieTheaterCode, roomCode, sectionCode } = params;
453
+ // まずルーム検索
454
+ const screeningRoomDoc = yield this.placeModel.findOne({
455
+ typeOf: { $eq: factory.placeType.ScreeningRoom },
456
+ 'project.id': { $eq: projectId },
457
+ 'parentOrganization.id': { $exists: true, $eq: sellerId },
458
+ 'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode },
459
+ branchCode: { $eq: roomCode }
460
+ }, { _id: 1 })
461
+ .lean()
462
+ .exec();
463
+ // console.log('screeningRoomDoc:', screeningRoomDoc);
464
+ if (screeningRoomDoc === null) {
465
+ return [];
466
+ }
467
+ const matchStageBeforeUnwind = {
468
+ $match: { _id: { $eq: screeningRoomDoc._id } }
469
+ };
470
+ const matchStages = SeatRepo.CREATE_MATCH_STAGES(Object.assign(Object.assign({}, options), { containedInPlace: {
471
+ branchCode: { $eq: sectionCode },
472
+ containedInPlace: {
473
+ containedInPlace: {}
474
+ }
475
+ } }), { filterTypeOf: false });
476
+ const pageMustBeOne = (typeof page === 'number' && page > 0) ? page : 1;
477
+ let skipStage;
478
+ let limitStage;
479
+ if (typeof limit === 'number' && limit > 0) {
480
+ skipStage = { $skip: limit * (pageMustBeOne - 1) };
481
+ limitStage = { $limit: limit };
482
+ }
483
+ else {
484
+ throw new factory.errors.Argument('limit', 'must be number > 0');
485
+ }
486
+ const pipeline = [
487
+ // uniwind前はドキュメントの_id指定
488
+ matchStageBeforeUnwind,
489
+ {
490
+ $unwind: {
491
+ path: '$containsPlace'
492
+ // includeArrayIndex: 'sectionIndex'
493
+ }
494
+ },
495
+ {
496
+ $unwind: {
497
+ path: '$containsPlace.containsPlace'
498
+ // includeArrayIndex: 'seatIndex'
499
+ }
500
+ },
501
+ ...matchStages,
502
+ {
503
+ $project: {
504
+ _id: 0,
505
+ branchCode: '$containsPlace.containsPlace.branchCode',
506
+ name: '$containsPlace.containsPlace.name',
507
+ seatingType: '$containsPlace.containsPlace.seatingType',
508
+ maximumAttendeeCapacity: '$containsPlace.containsPlace.maximumAttendeeCapacity',
509
+ additionalProperty: '$containsPlace.containsPlace.additionalProperty'
510
+ }
511
+ },
512
+ // {
513
+ // $sort: {
514
+ // // branchCode: factory.sortType.Ascending
515
+ // }
516
+ // },
517
+ skipStage,
518
+ limitStage
519
+ ];
520
+ // console.log(pipeline);
521
+ return this.placeModel.aggregate(pipeline)
522
+ .option({
523
+ maxTimeMS: settings_1.MONGO_MAX_TIME_MS
524
+ // explain: true,
525
+ // hint: 'searchSeatsSort'
526
+ })
527
+ .exec();
528
+ });
529
+ }
448
530
  /**
449
531
  * 座席区分集計検索
450
532
  */
@@ -37,6 +37,26 @@ export declare class SectionRepo {
37
37
  };
38
38
  }, $unset: any): Promise<IUpdateSectionResult>;
39
39
  searchScreeningRoomSections(searchConditions: factory.place.screeningRoomSection.ISearchConditions): Promise<IScreeningRoomSectionWithoutContainsPlace[]>;
40
+ /**
41
+ * ルーム指定のセクション検索として再定義(2025-12-07~)
42
+ */
43
+ findSectionsByRoom(params: {
44
+ limit: number;
45
+ page: number;
46
+ projectId: string;
47
+ /**
48
+ * 販売者ID
49
+ */
50
+ sellerId: string;
51
+ /**
52
+ * 施設コード
53
+ */
54
+ movieTheaterCode: string;
55
+ /**
56
+ * ルームコード
57
+ */
58
+ roomCode: string;
59
+ }): Promise<Pick<IScreeningRoomSectionWithoutContainsPlace, 'additionalProperty' | 'branchCode' | 'name'>[]>;
40
60
  deleteScreeningRoomSection(screeningRoomSection: {
41
61
  project: {
42
62
  id: string;
@@ -248,6 +248,53 @@ class SectionRepo {
248
248
  .exec();
249
249
  });
250
250
  }
251
+ /**
252
+ * ルーム指定のセクション検索として再定義(2025-12-07~)
253
+ */
254
+ findSectionsByRoom(params
255
+ // options: Pick<
256
+ // factory.place.screeningRoomSection.ISearchConditions,
257
+ // 'branchCode'
258
+ // >
259
+ ) {
260
+ return __awaiter(this, void 0, void 0, function* () {
261
+ const { limit, page, projectId, sellerId, movieTheaterCode, roomCode } = params;
262
+ const matchStageBeforeUnwind = {
263
+ $match: {
264
+ 'project.id': { $eq: projectId },
265
+ 'parentOrganization.id': { $exists: true, $eq: sellerId },
266
+ 'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode }, // 施設コード
267
+ branchCode: { $eq: roomCode } // ルームコード
268
+ }
269
+ };
270
+ const aggregate = this.placeModel.aggregate([
271
+ // uniwind前はドキュメントの_id指定
272
+ matchStageBeforeUnwind,
273
+ { $unwind: '$containsPlace' },
274
+ // ...matchStages,
275
+ {
276
+ $project: {
277
+ _id: 0,
278
+ // typeOf: '$containsPlace.typeOf',
279
+ branchCode: '$containsPlace.branchCode',
280
+ name: '$containsPlace.name',
281
+ additionalProperty: '$containsPlace.additionalProperty'
282
+ }
283
+ }
284
+ ]);
285
+ if (typeof limit === 'number' && limit > 0) {
286
+ const pageMustBePositive = (typeof page === 'number' && page > 0) ? page : 1;
287
+ aggregate.skip(limit * (pageMustBePositive - 1))
288
+ .limit(limit);
289
+ }
290
+ else {
291
+ throw new factory.errors.Argument('limit', 'must be number > 0');
292
+ }
293
+ return aggregate
294
+ .option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
295
+ .exec();
296
+ });
297
+ }
251
298
  deleteScreeningRoomSection(screeningRoomSection) {
252
299
  return __awaiter(this, void 0, void 0, function* () {
253
300
  var _a;
@@ -38,5 +38,11 @@ export declare class TicketRepo {
38
38
  * 承認コードからチケットを発行する
39
39
  */
40
40
  issueByTicketToken(params: IIssueParams): Promise<Pick<ITicket, 'id'>>;
41
- projectFields(params: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<ITicket[]>;
41
+ findTickets(params: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<ITicket[]>;
42
+ /**
43
+ * 発行日時を一定期間過ぎたチケットを削除する
44
+ */
45
+ deleteTicketsByDateIssued(params: {
46
+ dateIssuedLt: Date;
47
+ }): Promise<void>;
42
48
  }
@@ -69,7 +69,7 @@ class TicketRepo {
69
69
  return { id: insertedId };
70
70
  });
71
71
  }
72
- projectFields(params, inclusion) {
72
+ findTickets(params, inclusion) {
73
73
  return __awaiter(this, void 0, void 0, function* () {
74
74
  var _a;
75
75
  const conditions = TicketRepo.CREATE_MONGO_CONDITIONS(params);
@@ -92,5 +92,18 @@ class TicketRepo {
92
92
  .exec();
93
93
  });
94
94
  }
95
+ /**
96
+ * 発行日時を一定期間過ぎたチケットを削除する
97
+ */
98
+ deleteTicketsByDateIssued(params) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ yield this.ticketModel.deleteMany({
101
+ dateIssued: {
102
+ $lt: params.dateIssuedLt
103
+ }
104
+ })
105
+ .exec();
106
+ });
107
+ }
95
108
  }
96
109
  exports.TicketRepo = TicketRepo;
@@ -2,6 +2,7 @@
2
2
  * リポジトリ
3
3
  */
4
4
  import type { AcceptedOfferRepo } from './repo/acceptedOffer';
5
+ import type { AcceptedPaymentMethodRepo } from './repo/acceptedPaymentMethod';
5
6
  import type { AccountRepo } from './repo/account';
6
7
  import type { AccountingReportRepo } from './repo/accountingReport';
7
8
  import type { AccountTitleRepo } from './repo/accountTitle';
@@ -94,6 +95,10 @@ export type AcceptedOffer = AcceptedOfferRepo;
94
95
  export declare namespace AcceptedOffer {
95
96
  function createInstance(...params: ConstructorParameters<typeof AcceptedOfferRepo>): Promise<AcceptedOfferRepo>;
96
97
  }
98
+ export type AcceptedPaymentMethod = AcceptedPaymentMethodRepo;
99
+ export declare namespace AcceptedPaymentMethod {
100
+ function createInstance(...params: ConstructorParameters<typeof AcceptedPaymentMethodRepo>): Promise<AcceptedPaymentMethodRepo>;
101
+ }
97
102
  export type Account = AccountRepo;
98
103
  export declare namespace Account {
99
104
  function createInstance(...params: ConstructorParameters<typeof AccountRepo>): Promise<AccountRepo>;
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.paymentMethod = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AdvanceBookingRequirement = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
13
- exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = exports.Person = void 0;
12
+ exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AdvanceBookingRequirement = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedPaymentMethod = exports.AcceptedOffer = void 0;
13
+ exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = exports.Person = exports.paymentMethod = void 0;
14
14
  var AcceptedOffer;
15
15
  (function (AcceptedOffer) {
16
16
  let repo;
@@ -24,6 +24,19 @@ var AcceptedOffer;
24
24
  }
25
25
  AcceptedOffer.createInstance = createInstance;
26
26
  })(AcceptedOffer || (exports.AcceptedOffer = AcceptedOffer = {}));
27
+ var AcceptedPaymentMethod;
28
+ (function (AcceptedPaymentMethod) {
29
+ let repo;
30
+ function createInstance(...params) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ if (repo === undefined) {
33
+ repo = (yield Promise.resolve().then(() => require('./repo/acceptedPaymentMethod'))).AcceptedPaymentMethodRepo;
34
+ }
35
+ return new repo(...params);
36
+ });
37
+ }
38
+ AcceptedPaymentMethod.createInstance = createInstance;
39
+ })(AcceptedPaymentMethod || (exports.AcceptedPaymentMethod = AcceptedPaymentMethod = {}));
27
40
  var Account;
28
41
  (function (Account) {
29
42
  let repo;
@@ -14,7 +14,7 @@ export declare function createStartParams(params: factory.assetTransaction.pay.I
14
14
  */
15
15
  id: string;
16
16
  }[];
17
- instrument: factory.action.trade.pay.IInstrument[];
17
+ instrument: factory.action.trade.pay.IPlaceOrderRelatedInstrument[];
18
18
  }, options: {
19
19
  checkedAction: {
20
20
  id: string;
@@ -7,7 +7,7 @@ exports.createStartParams = createStartParams;
7
7
  const factory = require("../../../factory");
8
8
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
9
9
  function createStartParams(params, options) {
10
- 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;
10
+ 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;
11
11
  const { instrument } = params;
12
12
  const paymentServiceId = (params.paymentService !== undefined)
13
13
  ? String(params.paymentService.id)
@@ -109,7 +109,12 @@ function createStartParams(params, options) {
109
109
  : undefined);
110
110
  const object = Object.assign({ accountId: (typeof accountId === 'string') ? accountId : '', paymentMethodId: params.transactionNumber, typeOf: params.paymentServiceType, id: paymentServiceId,
111
111
  // onPaymentStatusChanged: { informPayment: params.informActions }, // discontinue(2025-02-09~)
112
- paymentMethod }, (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.MovieTicket)
112
+ paymentMethod, serviceOutput: (((_0 = params.object.serviceOutput) === null || _0 === void 0 ? void 0 : _0.typeOf) === 'Invoice') // support serviceOutput(2025-11-24~)
113
+ ? params.object.serviceOutput
114
+ : {
115
+ typeOf: 'Invoice',
116
+ referencesOrder: { typeOf: factory.order.OrderType.Order }
117
+ } }, (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.MovieTicket)
113
118
  ? { checkedAction: { id: options.checkedAction.id } } // add checkedAction(2024-12-13~)
114
119
  : undefined);
115
120
  const potentialAction = [];
@@ -118,7 +123,7 @@ function createStartParams(params, options) {
118
123
  potentialAction.push({ id: informAction.id, typeOf: factory.actionType.InformAction });
119
124
  }
120
125
  });
121
- return Object.assign(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, transactionNumber: params.transactionNumber, typeOf: factory.assetTransactionType.Pay, agent: params.agent, recipient: params.recipient, object, expires: params.expires, instrument: (Array.isArray(instrument)) ? instrument : [] }, (typeof ((_0 = params.location) === null || _0 === void 0 ? void 0 : _0.typeOf) === 'string')
126
+ return Object.assign(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, transactionNumber: params.transactionNumber, typeOf: factory.assetTransactionType.Pay, agent: params.agent, recipient: params.recipient, object, expires: params.expires, instrument: (Array.isArray(instrument)) ? instrument : [] }, (typeof ((_1 = params.location) === null || _1 === void 0 ? void 0 : _1.typeOf) === 'string')
122
127
  ? { location: params.location }
123
128
  : undefined), (potentialAction.length > 0) ? { potentialAction } : undefined // add potentialAction(2025-02-05~)
124
129
  );